Using range(1,101), make two list, one containing all even numbers and other containing all odd numbers. How can I do this on Python

Answers

Answer 1

Answer:

even = []

odd = []

for i in range(1,101):

if i % 2 == 0:

even.append(i)

else:

odd.append(i)

Answer 2

Using range(1,101), the list of even and odd number can be done in python as follows;

odd_numbers = []

even_numbers = []

for i in range(1, 101):

  if i%2 == 0:

     even_numbers.append(i)

  else:

     odd_numbers.append(i)

print(even_numbers)

print(odd_numbers)

The variable odd_numbers is initialise with an empty list

The variable even_numbers is initialise with an empty list.

Then we loop through the range 1 to 101 as required.

If the looped numbers is divided by 2 without a remainder then the number is appended to the empty list even_numbers.

Else if it has a remainder, the looped number are appended to the empty list, odd_numbers.

Then we print the even_numbers and odd_numbers.

learn more about python here; https://brainly.com/question/14157737?referrer=searchResults

Using Range(1,101), Make Two List, One Containing All Even Numbers And Other Containing All Odd Numbers.

Related Questions

Other Questions
If the simple interest on $3000 for 3 years is $720 , then what is the interest rate? I WILL GIVE 50 POINTS AND BRAINLIEST. Now do I have ur attention :PSay some interesting fact or something cool or funny. Winner gets brainliest plz help me with thi quston Stormer Company reports the following amounts on its statement of cash flow: Net cash provided by operating activities was $37,500; net cash used in investing activities was $13,800 and net cash used in financing activities was $17,700. If the beginning cash balance is $6,900, what is the ending cash balance? a) $75,900. b) $62,100. c) $40,500. d) $6,000. $12,900. White House pets often become almost almost as well known as their owners A-action verbB-helping verbC-linking verbD- none of the above Li and S - covalent or ionic bond? What is the charge of the outside of the DNA molecule? Write a FormulaCompound Name: Strontium Sulfate Who are sherpas?How have they added to the economiy of the land? SOMEONE PLZ HELP JSJSJSNSJNSNSNSNSNNS I HAVE 30 MINS LEFT PLZ How did John Quincy Adams influence US foreign policy? HELP PLEASE 12 POINTS Describe the standard of living in North Africa. Be sure to discuss factors such as live expectancy, literacy, and population growth. Followers of Dharmic religions, such as Hinduism and Buddhism, __________. A. share a belief in a single god (monotheism) B. believe in a constant cycle of life and rebirth C. follow the teachings of Siddhartha Gautama D. share many of the holy texts of Judaism Solve the following system of equations.3x + 2y - 5 = 0x = y + 10Make sure there are NO SPACES in your answer. Include a comma in your answer.ANSWER: What are some of the important symbols in "Everyday Use"? Why are they important? What types of insurance is David likely to get through his employer?David has just joined a new company. His employer offers a number of different insurance policies as one of its employee benefits. For example, his employers (Blank) insurance covers prescription drugs and immunizations. David will also be receiving (blank) insurance at no cost from his employer.1. casualty, health, life2. automobile, disability, renters Find the slope of the table (05.03 LC)Read and choose the correct option to complete the sentence.Soy Trisha. Hace cinco aos que ________ a La Repblica Dominicana.Question 5 options:viajviajaronviajviajaste The chart below contains the results of a survey in which students were asked about their cell phone plan.Cell Phones PlansPlanStudentsNo cell phone20Voice only14Voice and texting12Voice, texting, and data4What percent of the students surveyed have a phone plan with texting?16%24%32%68%If you get it right you get the crown brain thing