+ 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

18th Oct 2017, 6:11 PM
Анна Григорян
Анна Григорян - avatar
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))
18th Oct 2017, 6:20 PM
Ali Tavana
Ali Tavana - avatar
+ 1
max = a if a > b and a > c else b if b > c else c
18th Oct 2017, 8:18 PM
Kartikey Sahu
Kartikey Sahu - avatar