Student can't get if elif final statement to print for discussion post for python

Richard Damon Richard at Damon-Family.org
Sun Nov 19 13:37:59 EST 2017


On 11/19/17 1:10 PM, Cheri Castro wrote:
> I've tried several variations but haven't been able to figure out why my final if elif statement won't print. I tried using return, I tried using 1's and 0's rather than yes and no. Not sure what the issue is. Please, help.
>
>
> #This function will print how many yes answers the user has and a message
> def correctAnswers(job, house, yard, time):
>      if correctAnswers == 'yes':
>          print ("Congratulations! You should get a puppy!")
>      else:
>          return "I'm sorry, you shouldn't get a puppy."

Why does one path print and the other return, those are different actions.

-- 
Richard Damon




More information about the Python-list mailing list