Write program that prompt user for strictly positive integer

Assignment Help Python Programming
Reference no: EM131888571

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

Reference no: EM131888571

Questions Cloud

Research a company and industry to conceptualize forming : Research a company and industry to conceptualize forming a new division of an existing company based on a new product or service.
Linguistic competence in working in non-english-speaking : A training session is provided for health professionals on the need for linguistic competence in working in non-English-speaking communities.
How would you tackle the given problem : If you were the president of NSU, how would you tackle this problem based on what you have learned in this course?
How the corporate leaders of southwest : Airlines integrate industry environment, corporate strategy, structure and culture to ensure goal achievement, smooth internal processes and external
Write program that prompt user for strictly positive integer : 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)
Large number of college students : State whether you Agree or Disagree with the following statement: A market research firm surveyed a large number of college students in different parts
Marketers trying to perform market segmentation : The family life cycle can be valuable to sport marketers trying to perform market segmentation. What group within the lifecycle do you think
Statements is not true regarding beta : The weighted average cost of capital (WACC) is: A firm whose equity has a beta of 1.0: Which of the following statements is NOT true regarding beta?
Organizational change and the different methods : Discuss why not changing can lead to organizational change and the different methods that managers can use to better manage change as it occurs.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd