I have an assignment to:
"Wrap this code in a function called compare(x, y).
Call compare three times: one each where the first
argument is less than, greater than, and equal to the second argument."
So I came up with this:
def compare(x, y):
if x < y:
print x, "is less than", y
elif x > y:
print x, "is greater than", y
else:
print x, "and", y, "are equal"
print compare(3, 5)
print compare(5, 3)
print compare(5, 5)
The problem is my result:
>>>
3 is less than 5
None
5 is greater than 3
None
5 and 5 are equal
None
>>>
What's with the "None"? I don't see anything that would give that output.
On a side note, how do you get script to show in the forum with colors like IDLE?