i have also tried instead of else. if a > 18 you may enter.Code:input("please enter your age: ") a = input() if a < 18: print "you may not enter." else: print " you may enter."
wen the program is ran and i put anythin either over or under 18 is says you may not enter. wut is wrong here? ( i didnt write the code in python, i just wrote it here )
Last edited by TkTech; 10-04-2009 at 09:48 AM.
whaat did my post just disapear? (not sure if this is an error or something)
anyway here it is again:
if you want to allow people who ARE 18 OR older:Code:a = input("please enter your age: ") if a > 18: print "you may enter" else: print "you may not enter"
short:Code:a = input("please enter your age: ") if a >= 18: print "you may enter" else: print "you may not enter"
Code:a = input("please enter your age: ") if a >= 18: print "you may enter" else: print "you may not enter"
edit: did a mod just delete my post 0.0
Yeah :/ Glanced away and thought I was still on a spam post, my bad :s
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks