Write a Python Program to Put Even And Odd Elements in a List Into Two Different Lists

Pubblicato il: 09 dicembre 2022
sul canale di: Code With TJ
126
0

Hello Programmers, Welcome to my channel.

In this video you will learn about how to Write a Python Program to Put Even And Odd Elements in a List Into Two Different Lists

Python Scripts
======================
https://codewithtj.blogspot.com/2024/...

Python Functions Solved
==========================
https://codewithtj.blogspot.com/2023/...

Python Programs Solved
============================
https://codewithtj.blogspot.com/2023/...


Code
=============================

length = int(input("Enter List Length : "))
numbers_list = []
for _ in range(length):
temp = int(input("Enter List Element : "))
numbers_list.append(temp)

even_list = [item for item in numbers_list if item % 2 == 0]
odd_list = [item for item in numbers_list if item % 2 != 0]

print("Even List is : ", even_list)
print("Odd List is : ", odd_list)

OUTPUT
==================Enter List Length : 10
Enter List Element : 34
Enter List Element : 45
Enter List Element : 23
Enter List Element : 21
Enter List Element : 9
Enter List Element : 78
Enter List Element : 85
Enter List Element : 44
Enter List Element : 55
Enter List Element : 78
Even List is : [34, 78, 44, 78]
Odd List is : [45, 23, 21, 9, 85, 55]

Keywords
=============================
#python #python3 #python_assignment #pythonprogramming #pythontutorial #pythonprojects #pythoncourse #pythonbaba #pythonforbeginners #pythonautomation #pythonbasic #pythonbeginners


In questa pagina del sito puoi guardare il video online Write a Python Program to Put Even And Odd Elements in a List Into Two Different Lists della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Code With TJ 09 dicembre 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 126 volte e gli è piaciuto 0 spettatori. Buona visione!