Challenge
Strings don't change
…find out what methods and slices really give, build a new string instead, then swap a letter in the middle of a code.
Showing 11–20 of 44
Challenge
…find out what methods and slices really give, build a new string instead, then swap a letter in the middle of a code.
Challenge
…from the bottom up to find the error, the function and the line, fix the bug there, then follow a longer traceback through four calls to a second bug.
Challenge
Go through the mission log and build a new list holding only the WARN and ERROR entries with append(), then let a minimum level decide what counts, the way logging tools filter by severity.
Article Python Fundamentals
…quotes (""") Perfect for longer messages with multiple lines: message = """ Space Station Report: Temperature is stable Oxygen levels normal All crew members safe """ print(message) Using backslash to…
Challenge
…and string repetition, then find a code inside a log line and mask it there before the line is saved.
Challenge
…and leaving the global fuel unchanged. Predict the last line, compare both values, fix it by returning the total, then write a function that uses only its parameters.
Challenge
Print the commander, the newest member and the crew size from a list with [0], [-1] and len(), then add the second in command and the whole roster joined into one line.
Challenge
…log entries to mission.log with with open(), one per line, read the file back and print it, then add an append_entry() function that adds lines at the end without wiping what is there.
Challenge
Choose New Norcia, Cebreros or Malargüe from the longitude under a spacecraft with an if/elif chain of ranges, then accept longitudes from 0 to 360 and reject values that can't be longitudes.
Challenge
…for the shift handover, with aligned columns and a totals line, then save the same data as a CSV file with csv.DictWriter for the spreadsheet people.