What types of keywords get parans in Python?

Long story short: Had a lot of trouble with the quiz in 5.3 regarding taking a user defined circumference and calculating diameter. The script I wrote worked just fine…but it took me a long time to get the fill in the blank quiz right.

Turns out the culprit was that I entered: return(diameter) when the quiz wanted: return diameter

The reason I was given was that print is a function and return is a statement. I don’t know how to distinguish between these two things. The module that introduces defining functions simply defines function as a ‘any body of code that performs some task’.

What is the difference between a function and a statement?

Sorry for the confusion - any feedback would be much appreciated!


You bet.

For me it is simply easiest to memorize. If I code, “Return x”, that is simply going to send the rest of the code the value of the variable x.

Print is one of those things that has the paren, and it’s good just to remember, I think, rather than reason it. Just remember that, anytime you print, you have to put the thing you are printing in paren. Print(x) prints the value of the variable x. Print(“x”) prints the letter “x”.

Syntax sometimes makes more sense to the computer than to us, perhaps this is one of those times.

Not many things in Python require parens, btw-- many more do not.

I appreciate it! I was hoping to be able to contextualize to make that memorization process more efficient. For example - it’s more efficient to remember that a verb is an action and a noun is a person, place, or thing than it is to memorize a table of nouns and verbs. But, if rote memorization is the best solution then that’s what I’ll do.

Just my opinion-- mainly because Print and Return are themselves so often used.