Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Python Expert

Task 1 -

Run and study the following code. Then extend it with your own code to compute the difference between the largest and smallest values in the list without using the builtins min() and max(), print it out, and check that the result is correct using the builtins.

Prompts the user for a seed for the random number generator,

and for a strictly positive number, nb_of_elements.

Generates a list of nb_of_elements random integers between 0 and 99,

prints out the list, computes the maximum element of the list without using the

builtin max(), prints it out, and confirms that the value is correct with the builtin.

Task 2 -

Run and study the following code. Then extend it with your own code to, without changing the seed, generate, a new list of the same length as the one generated before, but consisting of random elements between 0 and 19 included, compute the number of elements strictly less 5, 10, 15 and 20, and print those numbers out.

The operators /, // and % are used for floating point division, integer division, and remainder, respectively.

Prompts the user for a strictly positive integer, nb_of_elements,

generates a list of nb_of_elements random integers between 0 and 99, prints out the list,

computes the number of elements equal to 0, 1, 2 3 modulo 4, and prints those out.

Task 3 -

Write a program that prompts the user for a strictly positive integer N, generates a list of N random integers between -50 and 50 (included), prints out the list, computes the mean, the median and the standard deviation, and prints them out.

Compute them without using the mean(), median(), and pstdev() functions from the statistics module, and then check use these functions to check the results.

from random import seed, randint

from math import sqrt

from statistics import mean, median, pstdev

import sys

Attachment:- Assignment Files.rar

Python, Programming

  • Category:- Python
  • Reference No.:- M92716918

Have any Question?


Related Questions in Python

Lab assignment -background - we have discussed in detail

Lab Assignment - Background - We have discussed, in detail, the function of Stacks and Queues and how they are specifically implemented in Python. To get a better understanding of the utility of these data structures, we ...

Quesiton write a python script that counts occurrences of

Quesiton: Write a python script that counts occurrences of words in a file. • The script expects two command-line arguments: the name of an input file and a threshold (an integer). Here is an example of how to run the sc ...

Tasksdemonstrate data scraping of a social network of

Tasks Demonstrate data scraping of a social network of choice. Develop technical documentation, including the development of the code & detailing the results. Provide a report on the findings, that includes research into ...

Architecture and system integrationcase study queensland

Architecture and System Integration Case Study: Queensland Health - eHealth Investment Strategy After evaluating various platforms, Queensland Health finally decided to adopt a Service Oriented Architecture (SOA) for its ...

Show times in tmus and seconds1 an associate grasps an oven

Show times in TMUs and seconds. 1. An associate grasps an oven door within reach and pulls it open 18 inches with the left hand (he does not relinquish control of the door). With a pan in the right hand, he carefully pos ...

Environment setupthe first mini project will be based on

Environment Setup The first mini project will be based on Ladder Logic programming. We will be using Schneider Electric's IDE called SoMachine Basic to do the programming. The latest ver- sion of SoMachine Basic for Wind ...

Question a software company sells a package that retails

Question : A software company sells a package that retails for $99. Quantity discounts are given according to the following table: Quantity Discount 10 - 19 20% 20 - 49 30% 50 - 99 40% 100 or more 50% Write a program usi ...

Project reconnaissance and attack on ics

Project: Reconnaissance and Attack on ICS NetworksEnvironment Setup The second mini project will be based on Industrial Network Protocols, specifically the Modbus protocol. Please follow the instructions carefully to set ...

Simple python traffic lightswrite a program that simulates

Simple Python (Traffic lights) Write a program that simulates a traffic light. The program lets the user select one of three lights: red, yellow, or green. When a radio button is selected, the light is turned on, and onl ...

Question write a simple python program that takes use

Question: Write a simple python program that takes use inputs as non-zero digits and converts them into binary form. The response must be typed, single spaced, must be in times new roman font (size 12) and must follow th ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As