Results for “input”

Showing 11–20 of 21

  1. Article Mini projects

    Converting Temperatures in Python

    …of value retrieval or conversion. Therefore, using the input() function, we can get the menu choice and display the next command. choice = int(input("Enter 1 or 2 and press enter: ")) We assign the…

  2. Article Mini projects

    Managing Astronaut Medical Data with Python

    …4. Astronaut Personal Data Let's add some fields to input astronaut information. We're implementing setup_astronaut_tab and add_astronaut : def setup_astronaut_tab(self): #our name field…

  3. Challenge

    Decimal comma

    …and a comma before the decimals. Ask for a reading with input() and print it with two decimal places: Pressure: 1013.25 hPa Two replacements: remove the spaces, then turn the comma into a dot…

    Fix the code Easy 3 stages strings replace float ValueError
  4. 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
  5. Article Mini projects

    Base 6 Number System in Python

    …Decimal") print("3. Decimal to Eridian symbols") choice = input("Pick an option (1/2/3): ") if choice == "1": num = int(input("Enter a decimal number: ")) result = np.base_repr(num, 6) print(f"{num}…

  6. Article Python Fundamentals

    Python Functions for Beginners

    …already used functions. print() is one. So are len() , input() and int() . Somebody wrote them, gave each one a name, and now you can use them without ever looking at the code inside. This article is…

  7. Article Python Fundamentals

    A Practical Guide to Getting Started with Programming

    …km away") print(f"Mars is {mars_distance:,} km away") input() Double-click on your file and run it! If you see the distances printed, congratulations - you've written working code! Check other python…

  8. Article Python Fundamentals

    How to Start Programming in Python Fast

    …# String age = 25 # Integer height = 5.9 # Float User Input and Output user_name = input("What is your name? ") print("Hello, " + user_name + "!") Basic Arithmetic a = 5 b = 3 print(a + b) # Addition…

  9. Article Mini projects

    Medical dispenser - Don’t trust the user

    …is "stupid" See the problem? We're trusting external input for something safety-critical. It's like having a security door that asks visitors to self-report whether they're authorized. Better…