-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise1.py
More file actions
27 lines (22 loc) · 879 Bytes
/
exercise1.py
File metadata and controls
27 lines (22 loc) · 879 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
# Using explicit type conversion, change the following
# inputs so the types match with the following below
#
# name = type string
# age = type int
# height = type float
# loyalty = type boolean
# Modify the line below
name = input('What is your name? ')
print(f"Type of name variable is: {type(name)}. It should be <class 'str'>")
# Modify the line below
ageinput = input('What is your age? ')
age = int(ageinput)
print(f"Type of age variable is: {type(age)}. It should be <class 'int'>")
# Modify the line below
heightinput = input('What is your height in meters? ')
height = float(heightinput)
print(f"Type of height variable is: {type(height)}. It should be <class 'float'>")
# Modify the line below
loyalty = input('Are you part of our loyalty program? ')
isloyal = (loyalty == 'y')
print(f"Type of loyalty variable is: {type(isloyal)}. It should be <class 'bool'>")