Question: Here's the Python code for the stats.py program: import sys import stdio import random This program returns average, minimum, and maximum values given n

 Here's the Python code for the stats.py program: import sys import

Here's the Python code for the stats.py program:

import sys import stdio import random

""" This program returns average, minimum, and maximum values given n random numbers. """

n = int(sys.argv[1])

numList = []

for i in range(n): numList.append(random.random())

average = sum(numList) / 5

stdio.writeln(str("Max: " + str(min(numList)))) stdio.writeln(str("Min: " + str(max(numList)))) stdio.writeln(str("Avg: " + str(average)))

My question: is n assigned a command-line argument for PowerShell. If there is one, what is it? If there isn't one, how do I rewrite my code to include one? Thanks for your help!

Assignment 3 Compose a program stats.py that accepts an integer n as a command-line argument, uses random.random(to write n uniform random numbers between 0 and 1, and then writes their average value, their minimum value, and their maximum value. You will not get credit for this assignment if n is not assigned a command-line argument. Upload stats.py to Moodle

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!