Question: (x = random.randint(a,b) ) write a program that generates four integers between -50 and +50 and displays the calculations noted below. See the following code

(x = random.randint(a,b) ) write a program that generates four integers between -50 and +50 and displays the calculations noted below. See the following code (modify as needed)

import random a = -50 b = 50

x = random.randint(a,b) # returns an integer a <= x <= b

y = random.randint(a,b) # returns an integer a <= y <= b

z = random.randint(a,b) # returns an integer a <= z <= b

w = random.randint(a,b) # returns an integer a <= w <= b

Calculations/Display:

  1. Displays the four integers: Done)

print('1 random integers == ', x,' ',y,' ', z, ' ', w )

  1. The maximum integer (use max function)
  2. The minimum integer (use the min function
  3. The number of even integers (if x %2 == 0 then x is even)
  4. The number of odd integers
  5. The number of integers greater than -25 but less than 25 (if -25 < x and x < 25: )
  6. The number of positive integers
  7. The number of negative integers
  8. The average of the smallest and largest integers
  9. The average of all four integers

EXAMPLE OUTPUT

If the random number generator generated the four integers 22 -8 17 -5 then display

  1. The integers are 22 -8 17 -5
  2. The maximum integer is 22
  3. The minimum integer is -8
  4. The number of even integers is 2
  5. The number of odd integers is 2
  6. The number of integers greater than -25 but less than 25 is 4
  7. The number of positive integers 2
  8. The number of negative integers 2
  9. The average of the smallest and largest integers 7.0
  10. The average of the four integers is 6.5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!