Python 3 < 50 result is false -
ok, i'm starting python , no genius. have typed code:
from random import randint def start(): print ''' welcome hilo!!\n\n in game, computer take random number between 1 , 100.\nyou must guess whatthe number is, , tell if you're high or low. ''' ans = 50#randint(1,100) trie(ans) def trie(answer): guess = raw_input("your guess? >>>") int(guess) print guess print answer print 3 > 50 print guess > answer if guess < answer: too_less(answer) elif guess > answer: #too_much(answer) print "y" elif guess == answer: victory() elif guess <= 0: way_too_less() elif guess > 100: way_too_much() def too_less(answer): print "too low! try higher number" trie(answer) start() but if run in command line, this:
welcome hilo!!
in game, computer take random number between 1 , 100. must guess whatthe number is, , tell if you're high or low.
your guess? >>>3
3
50
false
true
y
why getting true foe second one? using python 2.7
int(guess) doesn't guess; believe want guess = int(guess).
Comments
Post a Comment