Results for “strip”

Showing 41–50 of 72

  1. 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.

    Write the code Easy 2 stages print output strings beginner
  2. Challenge

    Test the parser

    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…

    Write the code Medium 2 stages testing assert parsing None
  3. Challenge

    Real JSON

    …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…

    Write the code Easy 2 stages json json.loads modules import
  4. Article Python Fundamentals

    Python Functions for Beginners

    …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…

  5. Article Mini projects

    Managing Astronaut Medical Data with Python

    …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…

  6. Article Python Fundamentals

    Variables and data types in Python

    …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…

  7. Challenge

    Approved payloads

    …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.

    Write the code Easy 2 stages lists in membership if
  8. Challenge

    Missing reading

    …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 .

    Write the code Medium 2 stages if else None is None