-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInclassvariable.py
More file actions
47 lines (34 loc) · 1.14 KB
/
Inclassvariable.py
File metadata and controls
47 lines (34 loc) · 1.14 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Create variables with a string "Frankfurter", include years, hourly_wage, expert_status
title = "Frankfurter"
years = 23
hourly_wage = 65
expert_status = True #boolen (TRUE or FALSE)
# print the variables
print(title)
print(years)
print(hourly_wage)
print(expert_status)
# Print me the data type of each of these variables
print("The data type for variable title = ", type(title))
print("The data type for variable title = ", type(years))
print("The data type for variable title = ", type(hourly_wage))
print("The data type for variable title = ", type(expert_status))
# Variable to do calculations --> Calculate miles per gallon
total_miles = 257
gallon_gas = 7.2
miles_per_gallon = total_miles / gallon_gas
x = 257
y = 7.2
miles_per_gallon = total_miles / gallon_gas
total_miles = 400
print(miles_per_gallon)
original_price = 198.87
current_price = 254.32
increase = current_price - original_price
percent_increase = increase / original_price * 100
Percent_Increase = 27.88
formatted_percent_increase = f"{Percent_Increase:.2f}%"
print(formatted_percent_increase)
print(original_price)
print(percent_increase)
print(current_price)