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

  Create an infinite game loop

ISCG 5420 Programming - design into a Python program. Your final program must compile correctly using Python IDLE as configured in Unitec computing labs

  Write a python function to check whether a number is perfect

Write a Python function to check whether a number is perfect or not. According to Wikipedia : In number theory, a perfect number is a positive integer that is equal to the sum of its proper positive divisors.

  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.

  Write a non-fruitful function drawequitriangle

Write a non-fruitful function drawEquitriangle(someturtle, somesize) which calls drawPoly from the previous question to have its turtle draw a equilateral triangle

  Generate a plot with a point for every charging station

After you have imported your data, you should use matplotlib to generate a plot with a point for every charging station. Note that the first column of data is longitude, i.e., the y-values, and the second column is latitude, i.e., the x-values

  Write python code to implement a basic number guessing game

CSIS1101- Write Python code to implement a basic number guessing game. The program will choose a random number between 1 and 9 (inclusive) using randint() .

  Overall architecture diagram of the external facing system

Design a Service Oriented Architecture-based solution for a given domain. You must show a good understanding of Service Oriented principles. In addition you must show knowledge and understanding of specific SOA techniques, practices and approaches..

  Create a python program that allows user enter class name

Create a Python program that allows user enter class name, faculty name, name of each student, and letter grade each student earned.

  Write your own functions to rewire the network

Write your own functions to rewire the network according to the G(N;M) and Configuration Model random networks.

  Project - expand the simulation with a class hierarchy

Project: Expand the Simulation with a Class Hierarchy. Purpose: Expand classes into a hierarchy. Introduce a View to the Model-View-Controller design pattern. Provide more functionality to the simulation

  Implementing the card guessing game

CP5639 - IMPLEMENTING THE CARD GUESSING GAME - You are to implement (code in Python) a computer game as outlined in the description

  Write a script to plot given function in python

Write a script to plot this function in python 2.7.12 - It should still look like that if choose ai values to be 1 after the script

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