-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.py
More file actions
28 lines (22 loc) · 847 Bytes
/
input.py
File metadata and controls
28 lines (22 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Taking user input for variables
name = input("Enter your name: ")
age = int(input("Enter your age: "))
height = float(input("Enter your height in cm: "))
is_student = input("Are you a student? (yes/no): ").lower() == "yes"
print("Name:", name)
print("Age:", age)
print("Height:", height)
print("Is Student:", is_student)
# More Examples Input
weight = float(input("Enter your weight in pounds: "))
is_male = input("Are you male? (yes/no): ").lower() == "yes"
print("Weight:", weight)
print("Is Male:", is_male)
# Expressing print with 2 or 3 variable input
print(f"Name: {name}, Age: {age}, Height: {height}, Is Student: {is_student}")
# Expressing calculations input age with this year
current_year = 2023
birth_year = current_year - age
print(f"Birth Year: {birth_year}")
print(f"My Age Now: {age}")
print(f"My Age Next Year: {age + 1}")