Results for “strings”

8 results

  1. Article Mini projects

    Base 6 Number System in Python

    …numpy as np # numpy.base_repr(number, base) returns a string print(np.base_repr(12, 6)) # Output: 20 print(np.base_repr(36, 6)) # Output: 100 print(np.base_repr(101, 6)) # Output: 245…

  2. Article Mini projects

    Medical dispenser - Don’t trust the user

    …= event.copy() stored_hmac = event_copy.pop('hmac') event_string = json.dumps(event_copy, sort_keys=True) expected_hmac = self._compute_hmac(event_string) if expected_hmac != stored_hmac: raise…

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

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

  5. Article Python Fundamentals

    Python If/Else for Beginners

    …print("No payloads — skip deployment.") Empty lists, empty strings, zero, and None all evaluate to False . Pretty much everything else is True . Nesting: decisions within decisions You can nest if…

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

  7. Article Python Fundamentals

    Python print() Function

    …display: Mission Control, this is Python Space Station String quotation styles in programming Python gives you three ways to write text, and each has its special uses in space programming: Apostrophes…

  8. Article Python Fundamentals

    How to Start Programming in Python Fast

    …it out based on the value you assign. name = "Tom" # String age = 25 # Integer height = 5.9 # Float User Input and Output user_name = input("What is your name? ") print("Hello, " + user_name + "!")…