Quiz
Python Error Messages Quiz
…and strings to lists, dictionaries and functions. For each piece of code you decide which error it raises, read the message, or choose the fix. What the quiz covers NameError and IndentationError…
Showing 191–200 of 202
Quiz
…and strings to lists, dictionaries and functions. For each piece of code you decide which error it raises, read the message, or choose the fix. What the quiz covers NameError and IndentationError…
Challenge
…an empty list would crash min() and the division. For an empty list, print only No readings . Min: 398.0 Max: 455.2 Mean: 419.5 Spread: 57.2 Check len(readings) == 0 first, and move the summary under…
Challenge
…someone new joins, a backup steps in, someone leaves for another mission. The roster has to follow every change, in the right order, because position 1 is the deputy commander's place. Apply today's…
Challenge
…slice, and remember that the end index isn't included. For the last character, a negative index saves you counting.
Challenge
…operator=2 line.find(" ", start) searches for a space starting at index start , so it finds the space after the code, not the first one in the line. Then line.replace(code, masked) builds the new…
Challenge
…slice from where ERROR starts, plus its length, plus one for the space, and leave the end out. The time in brackets can grow longer, [T+100:02:00] , so work from position , not from a fixed number.
Challenge
…the unit next to it. Take the ID apart, then make it work for subsystems whose names contain a dash themselves. Subsystem and number Split the ID at the dash. Print the subsystem, the unit number as…
Challenge
The flight dynamics team is checking the plan for a transfer to the Moon. One leg comes from a contractor's planning tool, and the total doesn't look right. Predict what the code prints, find the leg…
Challenge
…one variable up to date instead of creating a new one for each step. Predict how -= and += change a value, follow the fuel through a whole sequence, then track a battery yourself. Predict and run…
Challenge
Somebody wrote a quick calculation for the cargo module and called the variables a , b , x2 and tmp . The program works, but nobody, including its author a month from now, can tell what it calculates…