forked from kartikagarwal9/Playground-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample1.py
More file actions
21 lines (17 loc) · 666 Bytes
/
Copy pathExample1.py
File metadata and controls
21 lines (17 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
>Write a program that calculates your shopping cost.
apple_price = 2
money = 10
input_count = input('How many apples do you want?: ')
count = int(input_count)
total_price = apple_price * count
print('You will buy ' + str(count) + ' apples')
print('The total price is ' + str(total_price) + ' dollars')
if money > total_price:
print('You have bought ' + str(count) + ' apples')
print('You have ' + str(money - total_price) + ' dollars left')
elif money == total_price:
print('You have bought ' + str(count) + ' apples')
print('Your wallet is now empty')
else:
print('You do not have enough money')
print('You cannot buy that many apples')