Example
Combining Different Argument Types
Combining regular parameters, *args and **kwargs in one function.
Showing 11–20 of 73
Example
Combining regular parameters, *args and **kwargs in one function.
Challenge
…out the crew after the next docking. Whatever number you type, it crashes. Predict what happens, find out why input() is behind it, fix it, then write a packing tool that reads two numbers. Predict…
Challenge
An operator types 42,5 and float() crashes with a ValueError. Predict it, find out why, accept both commas and dots with replace(), then read pressures written like 1 013,25.
Challenge
…with a message that shows the bad value, then raise TypeError, checked first, when the length isn't a number at all.
Challenge
The burn length is typed in by hand, and a typo stops the program with a ValueError. Catch it with try and except, keep asking until the input is a number, then also turn away zero and negative…
Challenge
A status line crashes with a TypeError because it joins text and a number with +. Predict it, read the error, fix it with str(), then build a docking status line.
Quiz
…quiz: 15 Python errors to read and fix – NameError, TypeError, ValueError, IndexError, KeyError, IndentationError and ZeroDivisionError.
Article Python Fundamentals
…through space exploration examples. Learn about number types, operators, and practical applications that will help you start your programming journey in an engaging way.
Challenge
…and dashes too, so commands match however operators type them.
Challenge
A 40-line pre-burn check has five bugs: a syntax error, a type error, a wrong key, an index out of range and a reversed decision. Read each error to fix the four that crash, then find the one that…