Quiz
Python For Loop Quiz
…nested loops in Python . After this one, try the Python If/Else Quiz or the Python Basics Quiz . What does this code print? How many times is Beep printed? What does this code print? Which of these…
Showing 41–50 of 100
Quiz
…nested loops in Python . After this one, try the Python If/Else Quiz or the Python Basics Quiz . What does this code print? How many times is Beep printed? What does this code print? Which of these…
Challenge
…that the crew member holds every permission in needed . If not, print what is missing, sorted: Kowalska can't depressurise the airlock: missing eva_certified needed <= granted is True when every item…
Challenge
…and end the countdown there, even at a second with a hold. If it reaches the end, print Liftoff! : T-10 T-9 T-8 T-7 HOLD at T-7 T-6 T-5 T-4 T-3 HOLD at T-3 T-2 T-1 T-0 Liftoff! With scrub_at = 4 , the…
Challenge
…. Then work out how many "waiting" lines there would be if second went up by 1 each time, and store it in waiting_lines . Remove any lines you added before you check. Modify. Make the loop move on to…
Article Mini projects
…or inform the user that they entered an incorrect value. if choice == 1: celsius = float(input("Enter the temperature in degrees Celsius: ")) kelvin = celsius_to_kelvin(celsius) print(f"The…
Challenge
A 70-line engine report repeats the same twelve lines for each engine. Restructure it into parse_feed() and summary_line() with the output unchanged to the character, then add assert tests that would…
Challenge
Extend the working cargo console: record every change to the hold in a history list and show it with a history command, then add undo, which takes the last change off the history and reverses it.
Challenge
status_light() returns None for Scrub because that branch sets a variable but never returns it. Predict the last line, find which statuses give None, make every path return, then write a function…
Example
Return can be used to exit function early when a condition is met.
Challenge
Write convert(), which looks a unit pair up in a table of factors, works the other way round by dividing, and refuses unknown units or missing pairs with a clear ValueError, then extend the table with…