AlexGaming77201 AlexGaming77201
  • 20-12-2021
  • Computers and Technology
contestada

Write a program that generates 100 random numbers and keeps a count of how many of those random numbers are even and how many of them are odd.

Respuesta :

6385726215
6385726215 6385726215
  • 24-12-2021

Answer:

import random

numbers = []

even = 0

odd = 0

for i in range(100):

   numbers.append(random.randint(1, 200))

for i in range(100):

   if numbers[i] % 2 == 0:

       even += 1

   else:

       odd += 1

print("Even:", even)

print("Odd:", odd)

Explanation:

Gg ez.

Answer Link

Otras preguntas

What is the vertex of (y+3)^2=12(x-1)
Why is investing in a mutual fund less risky than investing in a particular company's stock? A. Mutual funds only invest in blue-chip stocks. B. Investments in
How is geothermal energy transferred from nature to human use?
Suppose that the number of bacteria in a certain population increases according to a continuous exponential growth model a sample of 2700 bacteria selected from
What is the vertex of (y+3)^2=12(x-1)
In which layer of the sun do sunspots form?
Use the compound interest formula A = P(1 + r) and the given information to solve for r. A = $3,000,000, P = $20,000, t = 40
On the coordinate plane below, quadrilaterals TRAP and HELP are similar to each other. Which of the following options best describes the relationship of the ar
A line graph has a vertical axis labeled "Average plant mass (g)" and a horizontal axis labeled "Concentration of ammonium nitrate (mg/L)." What information is
development of new species as a result of the geographic separation of population called ?​