Example
Basic if Statement
Conditional if statement allows executing code only when condition is met.
Showing 171–180 of 202
Example
Conditional if statement allows executing code only when condition is met.
Example
Changing data types using int(), float() and str() functions. Converting between types.
Example
How to write comments in Python. Comments help other programmers understand your code.
Challenge
…the alert system all need those numbers, each in its own format, for every pass, including the ones where the sensor sent nothing. Write one function that returns the whole summary, then make it safe…
Challenge
The crew ask for cargo by ID all day long: "where is CG-0045, and how heavy is it?". Searching the whole manifest list for every question works for six items, but the real manifest has thousands…
Challenge
…Check an ID against the list, then make the check work for IDs typed by hand. On the list? Print whether the payload is on the approved list: PL-204 approved: True payload_id in approved gives True or…
Challenge
….png or .jpg images .csv telemetry anything else rejected For the camera image in the starter code: cam-1_2026-03-14.png -> images/ Use endswith() for each extension, or to accept two, and store the…
Challenge
…a photo and a backup file, and the archive's import broke for a day. Check every path before it's accepted, then make the checks work for paths typed on a Windows PC. Check the ends Print whether the…
Example
When to use tuples instead of lists? Comparison of properties and applications.
Challenge
…condition at a time, each inside the last, and the reason for a refusal now sits four levels deep, at the far end of an else whose if is off the top of the screen. Flatten the function without…