Define a function named numsinrange

Assignment Help Basic Computer Science
Reference no: EM132200938

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: EM132200938

Questions Cloud

Calculate present value of lifetime resources for consumer : A consumer is making saving plans for this year and next. His real income in the current period is y=120, and income in the future period is yf=131.
Recommended security solutions for organizations : What are the recommended security solutions for organizations using Software-as-a-Service (SaaS)?
Write a java program take input as string like sequen : Write a java program take input as string like sequen of number "123" then convert into interger then split it after that make an internal method.
Define a function immpairsbool : Define a function immPairsBool(..) which receives a string (containing letters, digits or special characters) and returns the Boolean
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).
The string should be converted to a character array : Write a Java program that provides searching a specific character in a string. The program asks the user which character to search for in the character array.
Display a message indicating so : 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
Calculate the income effect of the price change : Calculate the income effect of the price change. Verify that the Slutsky equation holds for your demand functions. You need only verify it for the own price.
Design a function named feettoinches : Design a function named feetToInches that accepts a number of feet as an argument, and returns the number of inches in that many feet.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Questions and requirements to write your paper

Please answer the following questions and requirements to write your paper of 4-5 pages. As you answer each question, you must provide support or evidence that will enhance and empirically prove your answers. Academic information technology (IT) a..

  Determine the largest angle ? so that it is self-locking

This requires no slipping for any magnitude of the force P applied to the joint

  Look for empirical-based research articles

Then look for empirical-based research articles to determine some findings... perhaps looking at it from the perspective of the provider and the perspective of the patient. What are some of the benefits and limitations identified in the literature..

  Evaluation goal be for a new system

What might an evaluation goal be for a new system aimed at teaching museum visitors about Greek jewelry?

  Runs in horizontal orientation

Come with an app that only runs in horizontal orientation. It displays "This is fun!" on the top left corner of the screen with no margin either from the top or

  Write a c program that determines if the input is a prime

write a C program that determines if the input is a prime guassian number or not. if it is, the output should print the number entered and say this is a prime number. If it is not, then the output should print the factor of the number entered and ..

  Compare and contrast database backup & disaster planning

Compare and contrast Database Backup & Disaster Planning. Highlight the importance of the integration of both backups and disaster planning and the impact if both are not effectively executed - 1 page.

  Branches across the united kingdom

A retail bookstore chain has branches across the United Kingdom. The senior management has strategically decided to implement a data warehousing solution to enable better decision-making and to gain a competitive advantage over its competitors. Im..

  What are three suggestions for improving query processing

Of the three suggestions, how do they compare to the rules below? Are there differences, similarities, or conflicting definitions?

  Local community non-profit organization

Web site topic: Your boss has asked you to create a web site for: a local community non-profit organization that sells rummage sale items. This week, they have asked you to set up 1 page to show what the site will look like.

  Review case - the wall street journal

According to The Wall Street Journal, merger and acquisition activity in the first quarter rose to $5.3 billion. Approximately three-fourths of the 78.

  Write a program that demonstrates the class

Write a program that demonstrates the class. The program should ask the user to enter a temperature, and then display a list of the substances that will freeze at that temperature and those that will boil at that temperature. For example, if the t..

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