Function definitions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Function definitions

Which line is wrong? def ann(): print "go ann!" def re_ann(): ann() ann() re_ann() I want to get the result as follow; "go ann!" "go ann!" How can I fix it ? Help me out :)

25th Jul 2016, 1:28 PM
shin eun kyung
shin eun kyung - avatar
5 Answers
+ 2
what output are you getting? with that code you should get "go ann!" printed twice. depending on the python version you migth want to use print("go ann!") instead of print "go ann!", but the rest should be ok.
25th Jul 2016, 5:23 PM
RedAnt
RedAnt - avatar
0
you call only ann () for 2nd.you don't make metode for it.or repeat again print to ann () for 2nd.you.
25th Jul 2016, 2:05 PM
M.Hossein.S.Zareei
M.Hossein.S.Zareei - avatar
0
Yes I got answrer . But i dont know why I should put bracket() after print. -0- In this case def hello(): print "nice to meet you" hello() The result of print works;;;;confusing
25th Jul 2016, 11:44 PM
shin eun kyung
shin eun kyung - avatar
0
you can't use hello () to owen hello method. ..thou can use outside method it.
26th Jul 2016, 12:45 PM
M.Hossein.S.Zareei
M.Hossein.S.Zareei - avatar
0
Thank you guys :) it helps me a lot. ~
27th Jul 2016, 1:28 PM
shin eun kyung
shin eun kyung - avatar