Most programming languages have statements to express multiway-decision logic (not just two cases, but many cases). Here is an illustration converting a number 1-7 into the corresponding name of the weekday.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
def weekday(number):
  if number==1:
     return "Monday"
  elif number==2:
     return "Tuesday"
  elif number==3:
     return "Wednesday"
  elif number==4:
     return "Thursday"
  elif number==5:
     return "Friday"
  elif number==6:
     return "Saturday"
  elif number==7:
     return "Sunday"
  else:
     return "Unknown"

The weekday function could be rewritten more simply, shown below. There are situations where using elif (and else) are the best choice.

1
2
3
4
5
6
7
8
def weekday(number):
  WDays = ["Monday","Tuesday","Wednesday",
           "Thursday","Friday","Saturday",
           "Sunday"]
  if number <= len(WDays):
     return WDays[number-1]
  else:
     return "Unknown"

Problem Suggestion: write a function dayweek(somestring) that does the converse of weekday, that is, it returns a number given an argument that is a string containing a day like "Wednesday".