Define a function named numsinrange

Assignment Help Basic Computer Science
Reference no: EM132185923

Define a function named numSinRange(..) which receives as parameter a list (which may be empty) of positive integer numbers (lnum) and returns one list (lres).

The numbers in lnum may be between 1 and 99 (in any order), there may be repeated numbers.

The function should count how many numbers in lnum fall within each of the ranges 0<x<=10, 10<x<=20, 20<x<=30, ... 80<x<=90, 90<x< 100  (there are 10 possible ranges)

lres should represent such result as follows:

For example, if 

lnum = [2,5,15,17,76,88,1,89,3]

then lres should be [4,2,0,0,0,0,0,1,2,0]

Other examples:

if lnum = [7]

then lres should be [1,0,0,0,0,0,0,0,0,0]

if lnum = [7,10]

then lres should be [2,0,0,0,0,0,0,0,0,0]

if lnum = [99]

then lres should be [0,0,0,0,0,0,0,0,0,1]

As an example, the following code fragment:

lnum = [2,5,15,17,76,88,1,89,3]

print(numSinRange(lnum))

should produce the output:

[4, 2, 0, 0, 0, 0, 0, 1, 2, 0]

language: python

Reference no: EM132185923

Questions Cloud

Find new labor demand at each of the same wage rates : If the price for guitar lessons goes up to $35/hour, Jim's demand for Labor will change. Find his new Labor demand at each of the same wage rates above.
Describe the role of analytics in healthcare : Describe the role of analytics in healthcare. How does HIT support or hinder this?
How can you make a topic more interesting : How can you make a topic more interesting when the audience sees no value in it?
Purely informative without being boring : Is it possible for an informative speech to be purely informative without being boring? What are some ways you can make your speech more engaging?
Define a function named numsinrange : Define a function named numSinRange(..) which receives as parameter a list (which may be empty) of positive integer numbers (lnum) and returns one list (lres).
Write out a pseudocode that will have two parallel array : Write out a pseudocode that will have two parallel array. One will be a String array named people that is initialized with the names of seven of your friends
Design a function named feettoinches that accepts a number : Design a function named feetToInches that accepts a number of feet as an argument, and returns the number of inches in that many feet.
Annual taxes on property using the formula : The county tax office calculates the annual taxes on property using the following formula:
Are the criticisms relevant to our current time : Write a paper addressing Marx's critiques of capitalism. Are the criticisms relevant to our current time? Why/why not? The response must be typed.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Design the requires and gives interfaces of at least

as the lead software engineer for a medium-sized hospital you have been asked to spearhead an effort to improve the

  Data mining from the commercial viewpoint

Q1. Give two examples, apart from those given in the slides, for each of the following: Data mining from the commercial viewpoint Data mining from the scientific viewpoint

  How to implement standard approach to systems development

"Implementing the standard approach to systems development helps experienced staff and new hires to be more productive, as they spend less time wondering how to do something and more time doing it?"

  Write about oracle 10g find vulnerabilities

Write about Oracle 10g find vulnerabilities, you should also include recommendations to address those vulnerabilities. Write as simple as possible.

  Effective technique for discovering errors in a program

1. Explain why program inspections are an effective technique for discovering errors in a program. What types of error are unlikely to be discovered through inspections?

  Development of a computer system

Suppose you are responsible for the design and development of a computer system to control an amusement park ride. Sensors in the seats will determine which seats are occupied, so the software can consider weight and balance.

  Show the procedure each station should follow

The contention window for each station has 31 slots. Station A randomly picks up the first slot; station B picks up the fifth slot; and station C picks up the twenty-first slot. Show the procedure each station should follow.

  How the balance between these two sets of data varies

Report on the statistical information that is being gathered by taxis and the passenger source; also on taxi idle time and missed pickups. Experiment with different numbers of taxis to see how the balance between these two sets of data varies.

  Calculate the surface area

Implement a class IceCreamCone with methods getSurfaceArea() and getVolume(). In the constructor, supply the height and radius of the cone. Be careful when looking up the formula for the surface area-you should only include the outside area along ..

  Discussionon microsoft website

This discussion board allows you to work with Word templates available on Microsoft's website. First, download a Word template from Microsoft.com by clicking Office, then Templates, then Word. Replace the placeholders with your own content.

  Calculate the test statistic

When testing the following hypotheses at the .01 level of significance with the t test, a sample mean of 301 is observed. I assert that if I calculate the test statistic and compare it to the t distribution with n - 1 degrees of freedom, it is pos..

  Does this create infinite recursion

Does this create infinite recursion? Write a program to check your observation.

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