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

Answers

Answer 1

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.


Related Questions

Other Questions
What is Russia doing about bioterrorism? A market that has a single supplier of a product with no close substitutes and barriers to entry is:________a. an oligopoly.b. monopolistically competitive.c. a pure monopoly. 2. Revere's document was well known at the time while Pelham's was less regarded. Over the years, Revere's painting has gained notoriety and has been frequently reproduced in textbooks and popular publications. How can this be explained? Factor the GCF: 14y2 + 12y 22 If you have a muscle that has atrophied, the muscle would be ______.A. brokenB. shrunkenC. tornD. strained b. Rico says it's a perfect square trinomial. Teresa says it's not a perfect square trinomial, because the first term is negative. Who is correct? Why or why not? The quotient of 8 divided by 1/5 will be _____ 8. Help pls thanks..... What is the volume of a cylinder with a diameter of 20 meters and a height of 4 meters? When farmers set the trees in an area on fire and allow them to burn in order to make the land more fertile, what type of farming are they practicing?A.overgrazingB.slash and burn farmingC.deforested farmingD.subsistence farming Maya has a dog and it wants to be pet 3. Hassan helps his dad with newspaper deliveries. He gets $5 every morning and 10 cents for every paper delivered. Hassan earned $20.60 one morning. He wondered how many papers he delivered.(a) Define the unknown in the scenario and assign it a letter or symbol.(b) Write an equation to represent the amount of money Hassan earned. pls help this is worth a little more than 10 pts bc itssoo important to be answered correctly, thx! A taxi driver charges a $2 fee plus an additional $4 per mile as shown by the graph.What is the cost of a 3-mile ride? $1 $10 $12 $14 Can anyone help its due in 10 minuets! COMPLETE THE TABLE PICTURED: A robot is put into a maze, it can only go N, E, S, and West. The value i represents the north, and the magnitude is equal to 1. I have figured out that N= i, East= 1, South= -i, and West= -1. When programming the robot, let the complex number d represent the direction the robot is facing. As the robot changes direction, the value of d will also change; so, the value of d is dependent on where the robot is in the maze. When the robot makes a turn, it would be useful to have an operation to perform on d to represent this turn. This is because after making a turn, the new value of d will depend on the old value of d. Complete the table for the new values of d if the robot is turning left or right. Then determine an expression in terms of d that will give the new position if the robot turns left and another expression if the robot turns right. Type these expressions in the last row of the table. Bigelow has a levered cost of equity of 14.29% and a pretax cost of debt of 7.23%. The required return on the assets is 11%. What is the firm's debt-equity ratio based on MM Proposition II with no taxes? Which is not the cost of rising unemployment in an economy? a)Lower Tax Revenues (Government collects less taxes)b)Higher Benefits Paymentsc)Crime, Vandalism, Family Breakdowns, Social Welfare, and Regional Decay in the Societyd)Opportunity Cost of Lost Potential Outpute)Flourishing Economy Determine whether the ordered pair (0, 2) is a solution to the equation -2x + y = -1O No, (0, 2) is not a solution.O Yes, (0, 2) is a solution Which evidence did Alfred Wegeners original theory of continental drift have access to? Matt is helping to set up drinks and snacks for a luncheon.Matt has 4.8 liters of iced tea. He is going to pour this into pitchers that can each only hold 0.8 liters of iced tea.If Matt pours an equal amount of iced tea into each pitcher, how many pitchers does he fill?