-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11_Fruit_Shop.py
More file actions
60 lines (51 loc) · 1.39 KB
/
Copy path11_Fruit_Shop.py
File metadata and controls
60 lines (51 loc) · 1.39 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
fruit = input()
day_of_week = input()
quantity = float(input())
price = 0.0
is_error = False # vyvejdam Flag koyto e False
if (day_of_week == "Monday" or
day_of_week == "Tuesday" or
day_of_week =="Wednesday" or
day_of_week == "Thursday" or
day_of_week == "Friday"):
if fruit == "banana":
price = 2.50
elif fruit == "apple":
price = 1.20
elif fruit == "orange":
price = 0.85
elif fruit == "grapefruit":
price = 1.45
elif fruit == "kiwi":
price = 2.70
elif fruit == "pineapple":
price = 5.50
elif fruit == "grapes":
price = 3.85
else:
is_error = True # is_error logicheski promenya izhoda
elif (day_of_week == "Saturday" or
day_of_week == "Sunday" ):
if fruit == "banana":
price = 2.70
elif fruit == "apple":
price = 1.25
elif fruit == "orange":
price = 0.90
elif fruit == "grapefruit":
price = 1.60
elif fruit == "kiwi":
price = 3.00
elif fruit == "pineapple":
price = 5.60
elif fruit == "grapes":
price = 4.20
else:
is_error = True
else:
is_error = True
final_price = quantity * price
if is_error: #ako e raven na True obratnata stoinost
print("error")
else: #ako e ostanal na stoinostta koyato set-nah
print(f"{final_price:.2f}")