[SOLUTION] List Functions and Methods | Class 38 | Python (Core & Advance) Course

preview_player
Показать описание
Welcome to the Python (Core & Advance) course! Whether you're a beginner or looking to advance your skills, this comprehensive playlist will guide you through Python programming from the fundamentals to advanced concepts.

🚀 Enroll in the Full Free Course along with resources/notes/assignments and much more:

Login with phone number 👆 and you will be able to access it for free.

🔗 Connect with Us:

📁 Course Materials:

📣 Stay Updated:
Subscribe for more tutorials: @codeanddebug

📧 For Inquiries:

🙏 Thank you for learning!
Рекомендации по теме
Комментарии
Автор

You are a great tutor. I was very worried about python, but juz bcz of you now I am learning and enjoying python. Thank you very much. You deserve millions of subscribers and I must say, you gonna achieve it too.

MohammadZaheerPathan
Автор

# Homework question

solving using while loop because while loop allows for manual control over the index i.
After removing an element with a.pop(i), the index i is not incremented, meaning the loop will check the new element that shifted into the current position.

a=[45, 66, 66, 66, 66, 78, 11, 11, 12, 12, 12]
i=0
while i<len(a):
if a[i]%2==0:
a.pop(i)
else:
i+=1
print(a)

priyankasuryavanshi
Автор

3) Remove all the even numbers from the list.
lst = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print("Original list", lst)
for i in lst:
if i % 2 == 0:
lst.remove(i)
print("Updated list without even numbers", lst)

ronnieee
Автор

Question107.
Answer:


my_list = [32, 44, 10, 15, 20, 25, 30, 97]
updated_list = []
n = int(input("Enter a Number: "))
for i in my_list:
if i%n!=0:
updated_list.append(i)
print(updated_list)

ashishvats
Автор

"""
Question : Remove all the even numbers from the list.
"""
my_list=[99, 54, 22, 37, 48, 97, 8]
even_num=[]
for i in my_list[:]:
if i%2==0:
even_num.append(i)
my_list.remove(i)
print(f"After removing even number from a list: {my_list}")
print(f"Even numbers list: {even_num}")

ashishvats
Автор

Sir sare even number nahin delete ho raha hey

lapulga-jlen
Автор

Need the answer for question 104. Without using a new list

BhushanUrs
Автор

last Q mai Merged list automatically sort kese horhi?

ronnieee
Автор

Q. 106

my_list = [45, 66, 66, 66, 66, 78, 11, 11, 12, 12, 12]

for i in reversed(my_list):
if i % 2 == 0:
my_list.remove(i)

print(my_list)

Amituday
join shbcf.ru