python - Program Returning nothing -


i saw flowchart , decided make program out of it. problem is, returns "go outside" if enter "no" first time. others return "none". im using python 2.7

def waitawhile():     print "wait while"     rain2 = raw_input("is still raining?")     if rain2.lower() == "no":         return "go outside"     elif rain2.lower() == "yes":         waitawhile() def raining():     print "is raining?"     rain = raw_input()     if rain.lower() == "no":         return "go outside"     elif rain.lower() == "yes":         print "have umbrella?"         umbrella = raw_input()         if umbrella.lower == "yes":             return "go outside"         elif umbrella.lower() == "no":             waitawhile() print raining() 

the problem calls waitawhile (from both raining , waitawhile itself). after calling it, you're discarding return value , returning nothing. fix it, change calls from:

waitawhile() 

to:

return waitawhile() 

make sure that, both functions, there no way reach end of function without executing return statement.


Comments

Popular posts from this blog

ios - Memory not freeing up after popping viewcontroller using ARC -

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -