Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
while loop
#6
I was just trying to show you how to do it without using try/except, in case you hadn't gotten that far in learning Python yet. I thought that might be the case because you said you got the original code from a tutorial. In general I tend to choose the simpler code. For checking if something is an integer, I tend to go with try/except. If I'm in a situation where the 'try' and 'if' solutions have similar complexity, or performance really matters, I'll go with 'if' if I expect there to be a lot of errors, and 'try' if I expect there to be few errors.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
while loop - by Blob - Nov-12-2019, 11:03 AM
RE: while loop - by perfringo - Nov-12-2019, 11:25 AM
RE: while loop - by jefsummers - Nov-12-2019, 12:21 PM
RE: while loop - by ichabod801 - Nov-12-2019, 12:46 PM
RE: while loop - by Blob - Nov-14-2019, 04:09 PM
RE: while loop - by ichabod801 - Nov-14-2019, 04:45 PM
RE: while loop - by Renym - Nov-15-2019, 01:50 PM
RE: while loop - by jefsummers - Nov-15-2019, 01:59 PM
RE: while loop - by ichabod801 - Nov-15-2019, 02:03 PM
RE: while loop - by the_ophidian_order - Nov-15-2019, 03:42 PM

Forum Jump:

User Panel Messages

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