if statement - If/else problems in python -


ok, i'm gonna explain best can.

i trying make if/else statement in python informs user if put in right age based on raw input, keep getting error in terms of if statement. can help?

from datetime import datetime = datetime.now()  print '%s/%s/%s %s:%s:%s' % (now.month, now.day, now.year, now.hour,now.minute, now.second) print "welcome beginning of awesome program created yours truly." print " it's time me know little bit you"  name = raw_input("what name?") age = raw_input("how old you?")          if age == 1 , <= 100             print "ah, name %s, , you're %s years old. " % (name, age)                 else:                         print " yeah right!" 

here formatted , corrected code:

import datetime  = datetime.datetime.now() print '%s/%s/%s %s:%s:%s' % (now.month, now.day, now.year, now.hour,now.minute, now.second) print "welcome beginning of awesome program created yours truly." print " it's time me know little bit you"  name = raw_input("what name?") age = raw_input("how old you?")  while int(age) < 1 or int(age) > 100:     print " yeah right!"     age = raw_input("how old you?")  print "ah, name %s, , you're %s years old. " % (name, age) 

also, double check indents , logic age.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -