So about the function Def, here the code I can solve it in two ways, which is better? Thank you | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

So about the function Def, here the code I can solve it in two ways, which is better? Thank you

the example it gave on the course is the one first one, and what I thought is the second one, so which is the best, or do they have different apply situations? thank you! https://code.sololearn.com/cV5omuT6LXkI/?ref=app

9th Sep 2018, 8:24 AM
jill jealous
jill jealous - avatar
2 Answers
+ 6
Returning and/or printing depends on how you integrate this piece of code with other code. At this point, it doesn't really matter You can do ternary, if it's your thing. def max(x,y): return (x if x >= y else y)
9th Sep 2018, 8:36 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Hatsy Rei got it! thank you
9th Sep 2018, 8:40 AM
jill jealous
jill jealous - avatar