Python Forum
Homework on conditional execution
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Homework on conditional execution
#4
There's a few problems here. First, you need a colon after lines 2 and 14. Now, if you enter something greater than 1, two conditionals trigger: the ones on line 2 and line 4. To stop this, make line 4 an elif, so that it only triggers if the number is 1.0 or less (that is, only if line 2 doesn't trigger). If you enter a number less than 0, line 12 triggers, when you really want line 14 or 16 to trigger. But look at line 12: you are testing if the number is less than 0.6. But you already know it's less than 0.6, because you've been testing greater than or equals for all the numbers 0.6 and above. So line 12 could just test that the number is greater than 0, and score that as an F. Then you could get rid of lines 14 and 15, and it should all work.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Homework on conditional execution - by Philippa - Jan-03-2020, 01:08 PM
RE: Homework on conditional execution - by DeaD_EyE - Jan-03-2020, 03:05 PM
RE: Homework on conditional execution - by ichabod801 - Jan-03-2020, 03:09 PM
RE: Homework on conditional execution - by Philippa - Jan-08-2020, 08:33 PM

Forum Jump:

User Panel Messages

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