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

A guest tries to use an expired coupon. they say the coupon was confusing and insists they get the discount
(answer asap no wrong answer or report.) What type of climate does southeast asia have? A. tropical, hot, wet climates B. arctic, cold, freezing climate C. fou
Find the size of the angle marked a
Helppp!!!! Asap I neeed to know which one it is.
What 2 operations are needed to solve 2x -4 =16
If f(x) is an exponential function where f(2)=23 and f(3)=58, then find the value of f(6), to the nearest hundredth.
any Indian chokri here?​
A gas occupies a volume of 500. milliliters at a pressure of 38.0 kPa and a temperature of 298 K. At what temperature will the gas occupy a volume of 250. milli
Indium-117 has a half-life of 43 minutes. If you start with 500 grams of indium-117, how much time will it take to have 31.25 grams of indium-117 left in the sa
Acceleration depends on which two factors?