Episode 6 of 29
Standard Input
Learn how to get user input from the keyboard using the input() function.
The input() function lets you get user input from the keyboard.
Basic Input
name = input("Enter your name: ")
print("Hello, " + name + "!")Input is Always a String
Convert for numbers:
age = int(input("Enter your age: "))
height = float(input("Enter height: "))
print("Age:", age, "Height:", height)Simple Calculator
num1 = float(input("First number: "))
num2 = float(input("Second number: "))
print("Sum:", num1 + num2)
print("Product:", num1 * num2)