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

A chunk of silver has a heat capacity if 42.8 j/*c. If the silver has a mass of 181g, calculate the specific heat of sliver.
What is it called when you don't eat meat except fish/seafood
Organisms made up of one or more cells with complex internal structure are called
What is it called when you don't eat meat except fish/seafood
If a man travels p hours at an average rate of q miles per hour, and then r hours at an average rate of s miles per hour, what is his overall average rate of sp
What is the symbol for aluminum thiosulfate?
If a standard drinking straw is 19.5 cm long and has a diameter of 0.6 cm how many square centimeters of plastic are used in one straw?
A total of 120,000 votes were cast for 2 opposing candidates, Garcia and Pérez. If Garcia won by a ratio of 5 to 3, what was the number of votes cast for Pérez?
Five times the sum of a number and one is 115. What is the number? Use x as your variable.
What are some solutions for Ukraine considering current situation?