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

Publicado em: 09 Dezembro 2022
no canal de: 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


Nesta página do site você pode assistir ao vídeo on-line Write a Python Program to Put Even And Odd Elements in a List Into Two Different Lists duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Code With TJ 09 Dezembro 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 126 vezes e gostou 0 espectadores. Boa visualização!