Challenge
Command parser
Write parse_command(), which turns typed commands such as burn 12.5 or set mode safe into tuples and raises ValueError with a reason for anything malformed, then run a whole batch of commands and…
Showing 51–60 of 86
Challenge
Write parse_command(), which turns typed commands such as burn 12.5 or set mode safe into tuples and raises ValueError with a reason for anything malformed, then run a whole batch of commands and…
Challenge
Load the downlink module's JSON settings over a copy of the defaults, check each value's type and range and report every problem in one go, then wrap it all in a load_config() that never crashes, even…
Challenge
Write problems(item), which lists everything wrong with one cargo item: missing fields, a mass that isn't a number, is 0 or is over the limit. Print a pass or fail line per item, then catch duplicate…
Challenge
Extend the formatter from "Duration formatter": work out the seconds left from the launch time and datetime.now(timezone.utc) instead of a number typed by hand, then turn it into a countdown() that…
Challenge
Make abort(reason, *, confirm) refuse to run unless confirm=True is passed by name: a bare * makes confirm keyword-only and required, then an is True check refuses values that are merely truthy, such…
Challenge
A call to schedule_launch() passes the pad where the rocket belongs, and the board says a launch pad is flying. Predict the line, find which parameter got which value, fix it with keyword arguments…
Quiz
…on print(), strings, lists, dictionaries, loops and functions, with instant answers.
Challenge
…the file back and print it, then add an append_entry() function that adds lines at the end without wiping what is there.
Example
…and end let you control separator and line ending in print function.
Article Python Fundamentals
…signal_data = 3 + 4j # Complex number representation wave_function = 2.5 + 1.8j # Used in quantum physics calculations antenna_impedance = complex(100, 20) # Creating from real and imaginary parts…