-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.py
More file actions
27 lines (18 loc) · 793 Bytes
/
input.py
File metadata and controls
27 lines (18 loc) · 793 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
# input() = A function that prompts the user to enter data
# Returns the entered data as a string
# Return된 data를 이용하기 위해선 변수를 이용한다.
name = input("What is your name?: ")
age = input("How old are you?: ")
print(f"Hello {name}!! You are {age} years old!!")
# age와 name 은 모두 string => string에서 integer로 형변환 하기
age = int(age) + 1
print(f"Hello {name}!! You are {age} years old!!")
length = float(input("Enter the length: "))
width = float(input("Enter the width: "))
area = length * width
print(f"area is: {area}")
item = input("What item would you like to buy?: ")
price = float(input("What is the price?: "))
quantity = int(input("How many would you like?: "))
total = price * quantity
print(f"total ${total}")