Question

home / study / engineering / computer science / computer science questions and answers / write...

home / study / engineering / computer science / computer science questions and answers / write a python program that generates a list of 50 random numbers. the program should display ...

Question: Write a python program that generates a list of 50 random numbers. The program should display (wi...

Write a python program that generates a list of 50 random numbers. The program should display (with labels) the sum, average, largest, and smallest of the list along with the list before and after sorting. Bonus: Find the mode (if any)

0 0
Add a comment Improve this question Transcribed image text
Answer #1
from random import randint


total = 0
min_value = None
max_value = None
lst = []
for i in range(50):
    num = randint(1, 100)       # generates random numbers between 1 and 100.
    if i == 0:
        min_value = num
        max_value = num
    if num < min_value:
        min_value = num
    if num > max_value:
        max_value = num
    total += num
    lst.append(num)

print('sum:', total)
print('average:', total/50)
print('largest:', max_value)
print('smallest:', min_value)


print('List before sorting: ' + str(lst))
lst.sort()
print('Sorted list: ' + str(lst))
Add a comment
Know the answer?
Add Answer to:
home / study / engineering / computer science / computer science questions and answers / write...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a python program that generates a list of 50 random numbers. The program should display...

    Write a python program that generates a list of 50 random numbers. The program should display (with labels) the sum, average, largest, and smallest of the list along with the list before and after sorting. Bonus: Find the mode (if any)

  • home / study / engineering / computer science / computer science questions and answers / Write...

    home / study / engineering / computer science / computer science questions and answers / Write A Second Game Program That Prints A Chart To The Screen Showing The Randomness Of A Die. ... Question: Write a second game program that prints a chart to the screen showing the randomness of a die. Th... Write a second game program that prints a chart to the screen showing the randomness of a die. The game should first prompt the client for...

  • home / study / engineering / computer science / computer science questions and answers / in...

    home / study / engineering / computer science / computer science questions and answers / in basic c please with comments so i can redo it on my own, thank you! for this lab, you only ... Question: In basic C please with comments so I can redo It on my own, thank you! For this lab, you only nee... In basic C please with comments so I can redo It on my own, thank you! For this lab, you...

  • home / study / engineering / computer science / computer science questions and answers / this...

    home / study / engineering / computer science / computer science questions and answers / this is a data modeling exercise i am assigned a project as a dba to design a data model to ... Question: This is a Data Modeling exercise I am assigned a project as a DBA to design a data model to suppo... This is a Data Modeling exercise I am assigned a project as a DBA to design a data model to support a...

  • home / study / engineering / computer science / computer science questions and answers / customer...

    home / study / engineering / computer science / computer science questions and answers / customer customerid,lastname,firstname, address,city,state,zip,email houses houseid, price ... Your question has been answered Let us know if you got a helpful answer. Rate this answer Question: Customer Customerid,lastname,firstname, address,city,state,zip,email Houses Houseid, price range,... Customer Customerid,lastname,firstname, address,city,state,zip,email Houses Houseid, price range, regionid, housename, bedroom no., pool, address, city,state,zip Reservations reservationid, customerid, date reservation, discount, start date, end date House amenities houseid, amenities id Price Range- houseid,price,start date,...

  • home / study / engineering / computer science / computer science questions and answers / l(a)...

    home / study / engineering / computer science / computer science questions and answers / l(a) be the language generated by g(a) - (n, 2, s, p) where 2 - [a, b), n= {s,x) and s->axb ... Your question has been answered Let us know if you got a helpful answer. Rate this answer Question: L(a) be the language generated by g(a) - (n, 2, s, p) where 2 - [a, b), n= {s,x) and s->axb ..... l(a) be the...

  • Can you help me write a Python 3.7 code for this question? Write a program using...

    Can you help me write a Python 3.7 code for this question? Write a program using functions and mainline logic which prompts the user to enter a number, then generates that number of random integers and stores them in a list. It should then display the following data to back to the user: The list of integers The lowest number in the list The highest number in the list The total sum of all the numbers in the list The...

  • Write a program in python that generates X random integers Num. Num is a random number...

    Write a program in python that generates X random integers Num. Num is a random number between 20 to 50. X is a random number between 10 to 15. Calculate and show the Smallest, Largest, Sum, and Average of those numbers. You are not allowed to use Python functions sample(), min(), max(), average(), sort(), sorted()!! HINTs: to find Smallest.... 1) X is a random number between 10 to 15... for example 11...this determines how many times the loop will happen...

  • Python Code Write a program using functions and mainline logic which prompts the user to enter...

    Python Code Write a program using functions and mainline logic which prompts the user to enter a number. The number must be at least 5 and at most 20. (In other words, between 5 and 20, inclusive.) The program then generates that number of random integers and stores them in a list. The random integers should range from 0 to 100. (You can use a wider range if you want, but the lower end of the range must be at...

  • Jubail University College Computer Science & Engineering Department Assessmen Assignment Course Code CS120/C5101 t Type: 1...

    Jubail University College Computer Science & Engineering Department Assessmen Assignment Course Code CS120/C5101 t Type: 1 Semester: 403 Course Title Programming Submission 27-06-2020 Total Points 8 Date Submission Instructions: • This is an individual assignment. • Please submit your program (Java fle) in Blackboard. You can create one java project, named as Assignment1_id and add separate java file for each question. You can name your javá files as 01.02.... etc. • Make sure that you include your student ID name...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT