Challenge
Validate a command
…anything else, then handle empty input and show what was typed.
Showing 31–40 of 73
Challenge
…anything else, then handle empty input and show what was typed.
Article Mini projects
…f, indent=2) def _create_event(self, event_type, success, reason=""): """Create a tamper-evident event record with proper HMAC""" # Use UTC time for persistence across restarts utc_now =…
Challenge
int() cuts the decimals off, round() rounds, and round(2.5) gives 2. Predict the difference, investigate Python's rounding rule, then round a fuel reading two ways.
Example
Parameters allow passing data to functions. Functions become more flexible.
Challenge
…gives back and store it, as text, in returned . Then print type(engine_k) and store the type's name in value_type . Remove any lines you added before you check. Modify. Make to_kelvin() give its…
Challenge
…why, compare the text instead, then read yes/no settings typed by hand.
Example
Lists store multiple elements in a specific order. Basics of working with lists.
Challenge
…time and datetime.now(timezone.utc) instead of a number typed by hand, then turn it into a countdown() that counts up with T+ after launch.
Challenge
The logistics team typed the manifest for the next supply flight by hand, and the loading crew won't touch a crate until every line checks out. Last time, a typo in a mass sent a 61 kg battery pack to…
Article Python Fundamentals
…Navigate to the directory where your Python file is saved. Type python your_file_name.py and press Enter. (Note: On some systems, you may need to use python3 instead of python .) For example, if you…