Click here to Skip to main content
15,919,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Write a program to accept ‘N’ integers in a list. Copy all even numbers to a second list
and odd numbers to third list. Display all the three lists.

What I have tried:

pls help me i have no answer to this question im seriously dead out there
iyhtcgr
k;jkhk
jmnhbgf
Posted
Updated 21-Feb-22 2:20am

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
Comments
CPallini 21-Feb-22 8:23am    
5.
Start with learning how to write a Python program - The Python Tutorial — Python 3.10.2 documentation[^]

The program you want to write either needs to prompt for a value of 'N' - that should be a whole number. Once that number has been input (or you have decided on a value for it), prompt the user that many times for more whole numbers - one at a time or separated by commas. This article might help https://towardsdatascience.com/a-complete-guide-to-user-input-in-python-727561fc16e1[^]

You should put each of these numbers into a list - see Python List (With Examples)[^]

Step through that list one by one - if the number is odd then add it to the "odd list", if it is even then add it to the "even list". When you have finished, output each list to the console - e.g. Print lists in Python (4 Different Ways) - GeeksforGeeks[^]

Hint: To determine if a number is even or odd use the Modulo operator - Python Modulo in Practice: How to Use the % Operator – Real Python[^] If a number is even then the remainder after dividing by 2 will be 0
 
Share this answer
 
Comments
CPallini 21-Feb-22 8:24am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900