Quiz
Python print() Quiz
…numbers, quotes and escape characters, and controlling the output with sep , end , flush and f-strings. What the quiz covers Single, double and triple quotes, and apostrophes inside text Escape…
Showing 21–30 of 32
Quiz
…numbers, quotes and escape characters, and controlling the output with sep , end , flush and f-strings. What the quiz covers Single, double and triple quotes, and apostrophes inside text Escape…
Article Python Fundamentals
…function, a fundamental tool in Python for displaying output. 4. Running Your Python Code Once you've written your code, it's time to see it in action! Here's how you can run your Python file…
Challenge
…that returns the record dict, and call it in the loop. The output must stay exactly the same: Records: 4 {'time': '09:30:05', 'sensor': 'ENG-2', 'value': 412.5, 'unit': 'C'} {'time': '09:30:05'…
Article Python Fundamentals
…Rover {name} found at coordinates ({scan_x}, {scan_y})") Output might look like this: === MARS SURFACE MAP === ⚫ ⚫ ⚫ 🔴 ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ 🔴 ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫…
Challenge
…, and replace the get() line with counts[level] += 1 . The output stays as it was: DEBUG: 2 ERROR: 1 INFO: 4 WARN: 3 Most common first Replace the sorted listing with one from the most common level…
Challenge
…statistics.median() : Mean: 418.8 C Median: 413.8 C The output doesn't change: that is the point of a refactor. The check looks for the module and makes sure your own functions are gone. Spread, and…
Challenge
…saying what it returns and what the reserve means. The output doesn't change: Burn 1: 330.0 kg Burn 2: 135.0 kg For example: """Fuel in kg for an engine burn, including a reserve. The reserve is a…
Challenge
…that returns the log line, and print what it returns. The output must stay exactly the same: [T+00:12:05] INFO Engines nominal Define the function at the top: def format_log(t, level, msg): , with…
Challenge
…more serious, and use min_level in the first line of the output: LEVELS = ["INFO", "WARN", "ERROR"] # from least to most serious min_level = "WARN" # show this level and above WARN and above: 4…
Challenge
…writes them. Raw string Run the script and look at the output: the path is split across two lines, with a strange gap in the middle. Fix the path so the script prints: Telemetry file…