Quiz
Python *args and **kwargs Quiz
…15) to pass You can try each idea in a runnable example: variable arguments with *args , variable keyword arguments with **kwargs , combining argument types and positional and keyword arguments…
Showing 11–20 of 53
Quiz
…15) to pass You can try each idea in a runnable example: variable arguments with *args , variable keyword arguments with **kwargs , combining argument types and positional and keyword arguments…
Challenge
…assigns to fuel_kg inside the function, creating a local variable and leaving the global fuel unchanged. Predict the last line, compare both values, fix it by returning the total, then write a…
Quiz
…quiz covers Comments, print() with sep and end , f-strings Variable names, data types and type conversion Arithmetic: // , % , ** and operator precedence Strings: indexing, slicing and string methods…
Quiz
…does, including leaving a function early Local and outside variables, and lists passed into a function Docstrings, calling one function inside another and passing a function as a value How it works 15…
Challenge
Unpack an (id, item, mass_kg) tuple into three named variables and print a cargo manifest line, then fix the ValueError when the manifest adds a fourth field.
Quiz
…questions built on the topics of the earlier quizzes, from variables and strings to lists, dictionaries and functions. For each piece of code you decide which error it raises, read the message, or…
Quiz
…this one, try the Python Data Types Quiz or the Python Variables Quiz .
Quiz
…, dictionaries and sets . After this one, try the Python Variables Quiz or the Python Basics Quiz . Which of these values is an int ? What does this code print? Which of these expressions give a float…
Challenge
Turn the bare 9.81 and 1000 in a weight report into named constants without changing the output, then write a Mars version with constants from the start.
Article Python Fundamentals
…greet_crew is the name. The rules are the same as for variable names: lowercase letters, words joined with underscores, no spaces, and it can't start with a number. The parentheses () are where inputs…