Content-Length: 2130 | pFad | http://github.com/codebasics/data-structures-algorithms-python/pull/99.patch
thub.com
From acfd97defb8d8bc3db07c83d14cf5e36227305d0 Mon Sep 17 00:00:00 2001
From: Rishikesh Nate
Date: Fri, 18 Jul 2025 23:02:49 +0530
Subject: [PATCH] rishikeshs soln2 for 2_arrays_exercise.md
---
data_structures/2_Arrays/2_arrays_exercise.md | 35 +++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/data_structures/2_Arrays/2_arrays_exercise.md b/data_structures/2_Arrays/2_arrays_exercise.md
index 81d65f4..909168f 100644
--- a/data_structures/2_Arrays/2_arrays_exercise.md
+++ b/data_structures/2_Arrays/2_arrays_exercise.md
@@ -8,6 +8,25 @@
5. May - 2190
Create a list to store these monthly expenses and using that find out,
+#solution
+expenses=[2200,2350,2600,2130,2190]
+print("in feb,how many dollars spent extra compared to jan",expenses[1]-expenses[0])
+print("total expenses in first quarter of year",expenses[0]+expenses[1]+expenses[2])
+print("did i spend exactly 2000 in any month?")
+for i in expenses:
+ if i==2000:
+ return true
+ break
+ else:
+ return false
+expenses.append(1980)
+expenses[3]=expenses[3]-200
+print("got refund in april",expenses[3])
+
+
+
+
+
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.
@@ -23,6 +42,12 @@ Create a list to store these monthly expenses and using that find out,
```
heros=['spider man','thor','hulk','iron man','captain america']
```
+print(len(heros))
+heros.append('black panther')
+heros.pop(6)
+heros.insert(3,'black panther')
+heros[1:3]='doctor strange'
+heros.sort()
Using this find out,
@@ -41,5 +66,15 @@ Using this find out,
3. Create a list of all odd numbers between 1 and a max number.
Max number is something you need to take from a user using input() function
+int max_num=print("enter your max odd num ",int(input())
+oddnos=[]
+ for i in range(1,max_num)
+ if(i%2==0)
+ oddnos.append(i)
+
+
+
+
+
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/2_Arrays/Solution/3_odd_even_numbers.py)
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/codebasics/data-structures-algorithms-python/pull/99.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy