Python Forum
Intializing return value to 0
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Intializing return value to 0
#2
The variable num is never 0 on line 10, because you add one to it on line 8. So you never return 0. Furthermore, if 'done' is the first response, the while loop doesn't run, and you return the default of None. Note that your return statement should be after the while loop. Right now the program returns after the second thing entered, no matter what.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Intializing return value to 0 - by adam10e10 - Apr-11-2019, 12:14 AM
RE: Intializing return value to 0 - by ichabod801 - Apr-11-2019, 02:14 AM
RE: Intializing return value to 0 - by loomski - Apr-11-2019, 05:43 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020