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? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

31st Aug 2016, 9:58 AM
Odogwudozilla
Odogwudozilla - avatar
7 Answers
+ 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.
3rd Sep 2016, 8:03 AM
Jkfive Thai
Jkfive Thai - avatar
+ 2
Hmmm, everything should work, visit Example_func in playground to see and compare your code with it)
31st Aug 2016, 11:15 AM
Leshark
Leshark - avatar
+ 2
that doesn't work only because we use def only for developing a function, not for seek a possibility.
1st Sep 2016, 11:32 PM
dukens joseph
+ 2
The Function has no error in it
27th Sep 2016, 2:31 PM
charumathi.n
charumathi.n - avatar
+ 1
it could work only a equality with x and y that's to say to give them a numeric valor
1st Sep 2016, 11:37 PM
dukens joseph
+ 1
here you no need to write a print statement when you implement return command. you can call the function directly without print statement.
2nd Sep 2016, 3:59 PM
joges chows
joges chows - avatar
0
i did it and it works very fine, the función is working ok
11th Sep 2016, 12:46 AM
romanrestrepo arboleda
romanrestrepo arboleda - avatar