8
8
5. May - 2190
9
9
10
10
Create a list to store these monthly expenses and using that find out,
11
+ #solution
12
+ expenses=[ 2200,2350,2600,2130,2190]
13
+ print("in feb,how many dollars spent extra compared to jan",expenses[ 1] -expenses[ 0] )
14
+ print("total expenses in first quarter of year",expenses[ 0] +expenses[ 1] +expenses[ 2] )
15
+ print("did i spend exactly 2000 in any month?")
16
+ for i in expenses:
17
+ if i==2000:
18
+ return true
19
+ break
20
+ else:
21
+ return false
22
+ expenses.append(1980)
23
+ expenses[ 3] =expenses[ 3] -200
24
+ print("got refund in april",expenses[ 3] )
25
+
26
+
27
+
28
+
29
+
11
30
12
31
1. In Feb, how many dollars you spent extra compare to January?
13
32
2. Find out your total expense in first quarter (first three months) of the year.
@@ -23,6 +42,12 @@ Create a list to store these monthly expenses and using that find out,
23
42
```
24
43
heros=['spider man','thor','hulk','iron man','captain america']
25
44
```
45
+ print(len(heros))
46
+ heros.append('black panther')
47
+ heros.pop(6)
48
+ heros.insert(3,'black panther')
49
+ heros[ 1:3] ='doctor strange'
50
+ heros.sort()
26
51
27
52
Using this find out,
28
53
@@ -41,5 +66,15 @@ Using this find out,
41
66
3 . Create a list of all odd numbers between 1 and a max number.
42
67
Max number is something you need to take from a user using input() function
43
68
69
+ int max_num=print("enter your max odd num ",int(input())
70
+ oddnos=[ ]
71
+ for i in range(1,max_num)
72
+ if(i%2==0)
73
+ oddnos.append(i)
74
+
75
+
76
+
77
+
78
+
44
79
[ Solution] ( https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/2_Arrays/Solution/3_odd_even_numbers.py )
45
80
0 commit comments