-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp1.py
More file actions
34 lines (32 loc) · 1.55 KB
/
Copy pathp1.py
File metadata and controls
34 lines (32 loc) · 1.55 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
# 1. Let us say your expense for every month are listed below,
# 1. January - 2200
# 2. February - 2350
# 3. March - 2600
# 4. April - 2130
# 5. May - 2190
#
# Create a list to store these monthly expenses and using that find out,
#
# 1. In Feb, how many dollars you spent extra compare to January?
# 2. Find out your total expense in first quarter (first three months) of the year.
# 3. Find out if you spent exactly 2000 dollars in any month
# 4. June month just finished and your expense is 1980 dollar. Add this item to our monthly expense list
# 5. You returned an item that you bought in a month of April and
# got a refund of 200$. Make a correction to your monthly expense list
# based on this
expenses=[2200,2350,2600,2130,2190]
# 1. In Feb, how many dollars you spent extra compare to January?
print("In feb i have used more than ",expenses[1]-expenses[0])
# 2. Find out your total expense in first quarter (first three months) of the year
print("Total expenses in the first quarter of the year is",expenses[0]+expenses[1]+expenses[2])
# 3. Find out if you spent exactly 2000 dollars in any month
for i in expenses:
if i==2000:
print("yes",i)
# 4. June month just finished and your expense is 1980 dollar. Add this item to our monthly expense list
expenses.append(1980)
print(expenses)
# 5. You returned an item that you bought in a month of April and
# got a refund of 200$. Make a correction to your monthly expense listbased on this
expenses[3]=expenses[3]-200
print("The updated amount of expense after the refund of the amount",expenses)