Challenge
Mission Control online
Print status lines that a monitoring system reads character by character. A first Python challenge on exact output with print(), right in your browser.
Showing 41–50 of 72
Challenge
Print status lines that a monitoring system reads character by character. A first Python challenge on exact output with print(), right in your browser.
Challenge
Write assert checks for parse_line() from "Parser function": the whole record for a good line first, then None for a blank line, a comment and a line with a missing field, so a broken parser can't…
Quiz
…beginner quiz on Python for loops: 15 questions on lists, strings, range(), enumerate(), totals and break, with instant answers.
Challenge
…is text, and the program stops with TypeError: string indices must be integers . Turn the text into a dict with json.loads() , then add a line for crewed : Launch: Lumen-3 Provider: JAXA Status: Go…
Article Python Fundamentals
…You can also describe a function with a docstring , a string in triple quotes placed right under the def line: def weight_on_planet(earth_weight, gravity=0.38): """Return what something would weigh on…
Article Mini projects
…column=0, padx=5, pady=5) self.astronaut_var = tk.StringVar() self.astronaut_dropdown = ttk.Combobox(self.medical_frame, textvariable=self.astronaut_var) self.astronaut_dropdown.grid(row=0, column=1…
Article Python Fundamentals
…complex(100, 20) # Creating from real and imaginary parts Strings (str) Text data, useful for storing names and descriptions: mission_name = "Artemis" spacecraft_status = 'Ready for launch' Boolean…
Example
Changing data types using int(), float() and str() functions. Converting between types.
Challenge
…cleared for loading PL-999: not on the approved list Strip the spaces and make it upper case, then use if with in . For " pl-117 " it prints the first line.
Challenge
…Check the field before converting it: ENG-2: NO 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 .