+ 1
I tried this code: def multiply_numbers(x, y): if x>y: return x else: return x*y print(multiply_numbers(4, 5)) It says syntax error on line 4. Can someone please help out?
7 ответов
+ 3
as it is now, it could work however line 4 is else so did you forget : that time thay why it's erroer aaat line 4.
+ 2
Hmmm, everything should work, visit Example_func in playground to see and compare your code with it)
+ 2
that doesn't work only because we use def only for developing a function, not for seek a possibility.
+ 2
The Function has no error in it
+ 1
it could work only a equality with x and y
that's to say to give them a numeric valor
+ 1
here you no need to write a print statement when you implement return command. you can call the function directly without print statement.
0
i did it and it works very fine, the función is working ok