jojovill6416 jojovill6416
  • 16-11-2020
  • Computers and Technology
contestada

Write code that generates a random odd integer (not divisible by 2) between 50 and 99 inclusive.

Respuesta :

Cytokine
Cytokine Cytokine
  • 16-11-2020

import random

nums = [x for x in range(50,100) if x%2!=0]

print(random.choice(nums))

We use a list comprehension to create a list of the odd numbers between 50 and 99. Then we randomly choose one of those numbers using the random module.

Answer Link

Otras preguntas

Kacey is making a necklace that is 16 inches long. She uses 5 beads for every inch. How many beads will she need. How can i explain how to solve it ?
Which line shows the first error in the solution? 5(x-5)=15 (1)       5x-25=15 (2)      5x-25=15-25 (3)  5x= -10 (4)  5x/5 = -10/5 (5) x=-2 (6) Answers: A. line
Why do people read newspaper?
For what value of x would be the quotient (3x²+4x-5) ÷ (x+2) not make sense?
the expression (3x^2)^4/9x^3 is equivalent to which other expression
I really need help on my math homework please anyone
For what value of x would be the quotient (3x²+4x-5) ÷ (x+2) not make sense?
What causes sediment to change into hard rock
what is the solution to the proportion? 9/x=4/12 Answers: A. 13 B. 27 C. 17 D. 3
Describe something that you think is a public good. Explain how it is non-excludable and non-rival. State whether you think the good should be provided by the g