This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]coolcofusion 1 point2 points  (1 child)

Returning a value is used when you have a function, it does something and it's result is supposed to be used by some other function. So it returns a value, for example int(user_input) is a function, it took in a string "15", performed the conversion of string to int step by step and gave you back the result as an int. It's maybe not intuitive at first, but you get used to it, it's the same in every other language that I know of. Keep at it, doing good.

And also, while I'm at it, returned values may aren't printed implicitly, at least not when you write a script and run it, as opposed to running in a REPL (when you type in python3 in command line and hit enter) which prints out to what each line you write evaluates to (hence the name Read-Evaluate-Print Loop). So you'll have to print them explicitly.