Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Else if
#4
I would modify your code like this:

def greater_less_equal_5(answer):
   if answer > 5:
       return 1
   elif answer < 5:
       return -1
   else:
       return 0
You can test this out in Idle or other python environment.
Reply


Messages In This Thread
Else if - by JohnnyCanuck - Jul-20-2017, 06:45 PM
RE: Else if - by ichabod801 - Jul-20-2017, 07:25 PM
RE: Else if - by JohnnyCanuck - Jul-20-2017, 07:43 PM
RE: Else if - by cygnus_X1 - Jul-20-2017, 07:53 PM
RE: Else if - by JohnnyCanuck - Jul-20-2017, 08:17 PM
RE: Else if - by cygnus_X1 - Jul-20-2017, 08:32 PM

Forum Jump:

User Panel Messages

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