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

  Project management framework

1) Define what the project management framework is and explain what pieces make up the framework. What are the processes and framework? What is the purpose of having a framework?

  Power and effectiveness of linear programming

In order to reinforce your understanding of the power and effectiveness of linear programming, review discussion questions 2-1, 2-2, and 2-3 in the textbook.

  Importance on disaster recovery

Explain why some organizations may not place enough importance on disaster recovery. What might happen to these organizations in the event of an actual disaster

  Draw a diagram like those in section

Draw a diagram like those in this section that pictures the stack s after the code segment is executed, or indicate why an error occurs.

  New report of shipped orders

The Marketing Department has requested a new report of shipped orders for which the order was placed on either a Saturday or a Sunday. Write a query which displays the order id, order date, shipped date, along with a calculated column labeled "Ord..

  Principle of internet architecture or technologies

Using principle of internet architecture or technologies, describe what happens when you go on Twitter or Instagram from your phone such as browse the content.

  Explain the tools that the federal reserve system

1. List and clearly explain the tools that the Federal Reserve System uses achieve its macroeconomic objectives. Use bullets points.

  Network infrastructure layer and in user clients or browsers

Web phishing, pharming and vishing are popular web based scams. Discuss currently used tools and recommended measures to defeat this kind of attacks efficiently? Specifically focus on solutions that can be implemented at the network infrastructure..

  Positive and negative effects of private art museums

What do private art museums do that the public galleries can't? Analyse the positive and negative effects of private art museums using at least two examples to illustrate your argument (one of which must be Australian). Are they individualistic or..

  Consulting agreement for a public library system

As part of a consulting agreement for a public library system, you are tasked with advising the organization on risks associated with both wired and wireless.

  Advantages and disadvantages of each

You may wish to consider several alternatives and think about the advantages and disadvantages of each.

  Multilayer infrastructure architecture

Using Visio, create a high level large enterprise data center design that follows the Cisco®multilayer infrastructure architecture. Please use the Insert/Comment or Insert/Text Box to provide a brief explanation of each component with detail.

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