Python Day 7: Positional-only and keyword-only arguments, plus return statements
This Python tutorial covers the Day 7 lesson on function parameter syntax and returning values. The slash (/) marks parameters that must be passed by position, so passing them by name raises a TypeError. The asterisk (*) marks parameters that must be passed by keyword, which is shown with examples of valid and invalid calls. A summary table and reminder explain that parameters before / are positional-only and those after * are keyword-only. The lesson also explains that the return statement sends a value from a function back to its caller, illustrated with a function that returns a trophy name based on comparing two scores.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in