How could you make this if/elif statement simpler without changing what it does
if (crowd > 500) == True:
return "Crowded"
elif (crowd < 5) == True:
return "Empty"
else: return "Okay"
a)replace elif for if
b)replace the numbers "500" and "5" with "True" and "False"
c)remove "== True" from each conditional
Answers
Answered by
1
Answer:
make it true statement or false
then the loop will come out if the control
Answered by
0
c)remove "== True" from each conditional will make the program simpler.
- if ( crowd > 500 ) :
- return "Crowded"
- elif ( crowd < 5 ) :
- return "Empty"
- else :
- return "Okay"
- This is the simpler program without changing what the previous program does.
- Thus c)remove "== True" from each conditional is the correct option.
Similar questions