Have an issue with a block of code someone wrote for me as an example. Doesn't work. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Have an issue with a block of code someone wrote for me as an example. Doesn't work.

def fish(colour); return colour + " fish" print fish("red") So a guy wrote this as an example of a function. I tried to copy it and i have checked it and its exactly as was originally written. Can anyone see what is wrong with it? Thanks

17th Oct 2016, 6:39 PM
Austin
2 Answers
+ 2
1)does it say syntax error this code is in python 2 and you are using python 3 2)you have used a ; at the end of line 1. it should be : python 3 code for the code you posted--> def fish(colour): return colour + " fish" print(fish("red"))
17th Oct 2016, 6:48 PM
Sunera
Sunera - avatar
0
:D thank you works now
17th Oct 2016, 6:49 PM
Austin