i've started learn python day ago, seems easy, still have questions :)
how write script have check necessary input of raw_input?
i mean, script must stop if user have not entered case , hit enter on raw_input...
ans = raw_input('enter: ') if not ans: print "you entered nothing!" else: print "you entered something!" if user hits enter, ans ''. , '' considered false, condition true (not false), if block run.
if wish continually ask user input, can use while-loop:
ans = '' while not ans: # while input given empty string ans = raw_input('enter: ')
Comments
Post a Comment