View difference between Paste ID: dDesiraJ and ZCMWe9mJ
SHOW: | | - or go back to the newest paste.
1
# Simple guess the number game
2
3
from random import randint
4
5
def findnumber():
6
	number = randint(1,100)
7
	print number
8-
	guess = raw_input("Guess a number between 1 and 100: ")
8+
9
	guess = 1
10
	while guess != number:
11-
		if not guess.isalpha():
11+
		guess = raw_input("Guess a number between 1 and 100: ")
12-
			print "That is not a number!"
12+
		if guess < number:
13-
		elif guess < number:
13+
14
			tries += 1
15
		elif guess > number:
16
			print "Guess lower!"
17
			tries += 1
18
		else:
19-
			findnumber()
19+
20
			tries += 1
21
			print "It took you %d tries!" % tries
22
23
print findnumber()