Challenge
Filter the log
…line.split()[1] . LEVELS.index(level) gives its rank, 0 for INFO up to 2 for ERROR, so compare the ranks.
Showing 11–20 of 202
Challenge
…line.split()[1] . LEVELS.index(level) gives its rank, 0 for INFO up to 2 for ERROR, so compare the ranks.
Challenge
Scan the mission log for the first ERROR entry, print its line number with enumerate() and stop there with break, then report how many lines were checked, or that there were no errors at all.
Article Python Fundamentals
…tells Python you're about to define a function. It's short for "define". greet_crew is the name. The rules are the same as for variable names: lowercase letters, words joined with underscores, no…
Challenge
Print one cargo manifest line for every record in a list of dicts, reading each field by key, then add up the masses in the same loop for a total line.
Challenge
Extend the OK/WARN/CRITICAL check from Alert level so a for loop runs it over every temperature in a list, then count the WARN and CRITICAL readings for a summary line.
Quiz
Free Python quiz for beginners: 20 multiple-choice questions on print(), strings, lists, dictionaries, loops and functions, with instant answers.
Challenge
Turn the day's subsystem status into a fixed-width report 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…
Challenge
…that every programmer meets once, then round it for display the way fuel gauges and dashboards do.
Challenge
…it to a 27:46:40 clock, then add days in the DDD/HH:MM:SS format.
Challenge
…in pages: a few results per request, and you ask again for the next page. The mission planners want one list of every launch. Merge the pages into one list, then fetch them the way a real client does…