+ 2
Problem with python code
def max_of_three(a,b,c): if a>b and a>c: return a elif b>a and b>c: return b else return c print(max_of_three(1,2,3)) what is the problem with this code? it always stops on 2nd line
4 Answers
+ 1
#copy and run this instead, it works :
def max_of_three(a,b,c):
if a>b and a>c:
return a
elif b>a and b>c:
return b
else:
return c
print(max_of_three(1,2,3))
+ 1
max = a if a > b and a > c else b if b > c else c