Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

rishikeshs soln2 for 2_arrays_exercise.md#99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
rishikesh6900 wants to merge1 commit intocodebasics:master
base:master
Choose a base branch
Loading
fromrishikesh6900:patch-1
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletionsdata_structures/2_Arrays/2_arrays_exercise.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
Expand All@@ -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,

Expand All@@ -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)


[8]ページ先頭

©2009-2025 Movatter.jp