-
Notifications
You must be signed in to change notification settings - Fork 0
/
lesson4.py
54 lines (42 loc) · 1.53 KB
/
lesson4.py
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
46
47
48
49
50
51
52
# Conditional Statements
# '''
# You decide you want to play a game where you are hiding
# a number from someone. Store this number in a variable
# called 'answer'. Another user provides a number called
# 'guess'. By comparing guess to answer, you inform the user
# if their guess is too high or too low.
# Fill in the conditionals below to inform the user about how
# their guess compares to the answer.
# '''
answer = 90
guess = 13
if guess < answer:
result = "Oops! Your guess was too low."
elif guess > answer:
result = "Oops! Your guess was too high."
elif guess == answer:
result = "Nice! Your guess matched the answer!"
print(result)
# '''
# Depending on where an individual is from we need to tax them
# appropriately. The states of CA, MN, and
# NY have taxes of 7.5%, 9.5%, and 8.9% respectively.
# Use this information to take the amount of a purchase and
# the corresponding state to assure that they are taxed by the right
# amount.
# '''
state = "NY"
purchase_amount = 50000
if state == "CA":
tax_amount = .075
total_cost = purchase_amount*(1+tax_amount)
result = "Since you're from {}, your total cost is {}.".format(state, total_cost)
elif state == "MN":
tax_amount = .095
total_cost = purchase_amount*(1+tax_amount)
result = "Since you're from {}, your total cost is {}.".format(state, total_cost)
elif state == "NY":
tax_amount = .089
total_cost = purchase_amount*(1+tax_amount)
result = "Since you're from {}, your total cost is {}.".format(state, total_cost)
print(result)