



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Worksheet for Python Functions EXAMSTYLE CODING PROBLEMS 2026 SOLVED EXAMPLES GRADED A
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!




โ Return statement. Answer: Sends a value back from a function to where it was called โ Function without return. Answer: A function that does not explicitly return a value returns None โ None. Answer: A special Python value meaning "no value" โ Function call. Answer: The act of running a function using parentheses and arguments โ Required argument. Answer: A parameter that must be provided when calling a function โ Optional argument. Answer: A parameter with a default value that may be omitted when calling a function โ Default parameter value. Answer: A value assigned to a parameter that is used if no argument is provided
โ Local variable. Answer: A variable defined inside a function that exists only within that function โ Global variable. Answer: A variable defined outside all functions and accessible throughout the program โ Variable scope. Answer: The region of a program where a variable is accessible โ Shadowing. Answer: When a local variable has the same name as a global variable โ print() function. Answer: Displays output to the screen but returns None โ print vs return. Answer: print displays a value; return sends a value back to the caller โ String multiplication. Answer: Repeating a string using the * operator and an integer โ Trailing space. Answer: A space character at the end of a string that affects output
โ List vs tuple. Answer: Lists are mutable; tuples are immutable โ Nested function calls. Answer: Function calls used as arguments inside other function calls โ Evaluation order. Answer: Inner function calls execute before outer ones โ Syntax error. Answer: An error caused by invalid Python code structure โ Indentation error. Answer: An error caused by incorrect indentation in Python โ Assignment error. Answer: Attempting to assign a value to something that is not a variable โ Keyword argument. Answer: An argument passed using parameter names โ Positional argument. Answer: An argument passed based on position โ Multiple values error. Answer: Error caused by passing the same argument both positionally and by keyword
โ String literal. Answer: A fixed string value written in quotes โ Variable reference. Answer: Using a variable name to access its stored value โ Returning a list. Answer: Sending a list back from a function using return โ Returning tuples. Answer: Returning immutable coordinate values from a function โ Coordinate tuple. Answer: A tuple representing a point, usually in the form (x, y) โ Rectangle shifting. Answer: Adjusting rectangle coordinates by adding x and y offsets โ Default shift values. Answer: Zero offsets that cause no movement โ Passing arguments correctly. Answer: Matching function parameters with arguments in order and type