0

what is the difference between return and print ????

def max(x, y): if x >=y: return x else: return y if i remove return and put print it will give the same answer, so what is the difference ???

17th Jul 2016, 10:01 AM
Ahmed Kamal
Ahmed Kamal - avatar
4 Answers
+ 2
print is Just an display of your values in normal usage. return values for usage in other place in script, return doesnt display value (except in python shell .
17th Jul 2016, 10:26 AM
Alexis Beaufils
Alexis Beaufils - avatar
0
@Alexis Beaufils, what is the python shell???
17th Jul 2016, 10:45 AM
Ahmed Kamal
Ahmed Kamal - avatar
0
this is the interactive python interpreter, ipython for exemple or just when you run "python" on your prompt
17th Jul 2016, 10:52 AM
Alexis Beaufils
Alexis Beaufils - avatar
0
@Alexis Beaufils, you mean the IDLE of python ???
17th Jul 2016, 10:56 AM
Ahmed Kamal
Ahmed Kamal - avatar