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

  Identify as integers from the input file

Design and implement a program that counts the number of integer values in a text input file. Produce a table listing the values you identify as integers from the input file.

  What property does this sentence demonstrate

John said, "I saw the man in the park with a telescope." What did he mean? How many reasonable interpretations can you provide for this statement? List them. What property does this sentence demonstrate that makes it unacceptable as a statement in..

  Rest of the world and expensive for the rest of the world

Rest of the World and expensive for the Rest of the World to buy German assets. (d) years of large German trade and current account surpluses.

  Determine the horizontal force p the man

The uniform 20-lb ladder rests on the rough floor for which the coefficient of static friction is µS = is and against the smooth wall at B. Determine the horizontal force P the man must exert on the ladder in order to cause it to move.

  Statements about current computer hardware is true

A hard disk is a type of volatile memory - Most of Intel's processors can still execute programs that were written for the 80386. When that processor was introduced in 1991, there were 275,000 transistors on the chip.

  Evaluate the cost of materials

Evaluate the cost of materials

  Distinguish between a compact disk and a magnetic disk

Define the step that a hard disk drive goes through to transfer a block of data from the disk to memory. Distinguish between a compact disk and a magnetic disk.

  Managing the relationship between it department

As a general manager, describe your strategy for managing the relationship between IT department and end-users departments

  Use html5 to create a document that contains

Insert a horizontal rule between the h1 element and the p element. Open your new document in a web browser to view the marked up document.

  Network design proposal part

Identify network services needed. List additional servers or network devices needed to implement the network. List network security measures to be implemented.

  Restrictions on choices for mapping general affine cipher

Consider the general affine cipher define by the mapping aX + b (mod 26). Discuss any restrictions on the choices of a and b in general.

  Should heel swaps move to the cloud

Heel Swaps is a Chicago-based start-up that sells a stretchable high heel shoe cover that contains a slip resistant out-sole, comes in a variety of sizes.

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