Challenge
Units and separators
…mass as 1234567 , and nobody on the flight deck wants to count digits during a launch. Format the numbers for people: a sensible number of decimal places, thousands separators and the right units. The…
Showing 61–70 of 76
Challenge
…mass as 1234567 , and nobody on the flight deck wants to count digits during a launch. Format the numbers for people: a sensible number of decimal places, thousands separators and the right units. The…
Challenge
…wants the mission elapsed time: how long since launch. Counting days and hours by hand across month ends goes wrong eventually, and the ground stations don't even agree on a time zone. Let the…
Article Mini projects
…stopwatch that starts when the program runs and just keeps counting up, immune to Grace's shenanigans. Important limitation: Monotonic time is only reliable within a single program session. It resets…
Article Mini projects
…yellow, white, to blue. At first glance, this may seem counterintuitive, but temperatures closer to red are cooler, while those closer to blue are hotter. In everyday life, we encounter this scale…
Quiz
…a ValueError Numbers kept as text: joining, comparing and counting digits What int() does to a negative float, and which values bool() turns into False Checking input with isdigit() , reading several…
Quiz
Scope decides where a variable can be seen and changed: a counter that starts again on every call, a fuel level shared by the whole program, a mission status kept inside a function within another…
Quiz
…, pop() and del Looping with keys() , values() and items() Counting with a dictionary, lists inside dictionaries and nested dictionaries How it works 15 questions: 11 with one correct answer, 4 where…
Challenge
…is the last item whatever the list's length, and len(crew) counts the items. The whole roster Add the second in command, who is second in the list, and the whole roster on one line: Commander: Okafor…
Challenge
…first, so the most recent are at the end. A negative start counts from the end, as with strings. The window moves A new reading has arrived. Add new_reading = 772 under the list, append it to the…
Challenge
…DATA Strip the field first, so a field with only a space counts as empty too, then compare it with "" . Convert with float() only in the else .