[Tutor] Question on If/Elif Statement in Python
eric grunfeld
grunfelderic at gmail.com
Wed Aug 12 12:39:55 EDT 2020
Good Afternoon Everyone:
I am running a basic If/Elif program/statement in Python.
I wanted to get your thoughts if I am running this correctly (I always seem
to have issues with indentation, since I am new to programming Python)
Here it is:
def number_group(number):
if number > 0:
return "Positive"
elif number < 0:
return "Negative"
else:
return "Zero"
print(number_group(10)) #Should be Positive
print(number_group(0)) #Should be Zero
print(number_group(-5)) #Should be Negative
I look forward to your feedback/thoughts on this.
All the best,
Eric
More information about the Tutor
mailing list