If you've read Andy Weir's Project Hail Mary , you probably remember (spoiler alert!) the moment when Ryland Grace tries to communicate with Rocky, the alien engineer from the 40 Eridani star system…
…with for name, level in tanks: and keep one copy of the if / else , with name in place of the letter. A fourth tank A fourth tank has been fitted. Add tank_d = 9.75 under tank_c and one more pair to…
…a planet. Time to calculate and display the weight: if chosen_planet in planets: gravity = planets[chosen_planet] weight = calculate_weight(mass, gravity) print(f"Your weight on {chosen_planet} would…
…Strings: indexing, slicing and string methods Conditions: if , elif , else and truthy values Lists, tuples, dictionaries and sets Loops with range() , break and continue Functions: default values…
…length can't be negative: {burn_s} s") inside an if , before the calculation. A burn of 0 seconds is allowed. Raise TypeError A burn length read from a file arrives as the text "40" , and the function…
…every record, print only the records of the wanted sensor. If there are none, say so: Records: 4 ENG-2 at 09:30:05: 412.5 C ENG-2 at 09:30:10: 415.0 C With wanted = "GYRO-X" , the last line is No…
…3 Start delay_s = 2 before the loop. After a failure, if attempt < MAX_ATTEMPTS , print the wait and double delay_s . (The simulator only prints the wait; real code would call time.sleep(delay_s) .)
…After this one, try the Python For Loop Quiz or the Python If/Else Quiz . What does this code print? What does this code print? Which statements about this code are true? What does this code print?…