Chapter 5 : Exercise 4 : Python tutorial 101

preview_player
Показать описание
Guys please help this channel to reach 20,000 subscribers. I'll keep uploading quality content for you.

Python is easy programming language to learn and anyone can learn it, and these tutorials are 100% free in hindi.

You can share this playlist with your brother, sisters and friends. This will surely add some values to their life.

If you follow this complete playlist of python tutorial surely you will learn everything about python programming language.

This is exercise 4 of chapter 5

Рекомендации по теме
Комментарии
Автор

def filter(x):
fil = [[], []]
for i in x :
if i % 2 == 0:
fil[0].append(i)
else:
fil[1].append(i)
return fil
x = [1, 3, 4, 6, 7, 9, 13, 34, 56, 79]
print(filter(x))

yu_a_vi
Автор

def seperate_odd_even(n: list)-> list:
"""This function takes a list as an arguments and returns odd and even number sepearated"""
return [[i for i in n if i%2 != 0], [i for i in n if i%2 == 0]]

siddharthmalviya
Автор

Well, this is my logic but I want to do it with pop and append method can anyone help me ???

def find(l):
length=len(l)-1
even=[]
odd=[]
for i in range(0, length):
if int(l[i])%2==0:
even.append(l[i])
else:
odd.append(l[i])
print(f"Even List: {even}")
print(f"Odd List :{odd}")

numbers=list(range(1, 11))
print(f"Entered List:{numbers}")
find(numbers)

rangesh
visit shbcf.ru