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

  How asymptotic notation can be used to rank the efficiency

To illustrate how asymptotic notation can be used to rank the efficiency of algorithms, use the relations "Ì" and "=" to put the orders of the following functions into a sequence, where e is an arbitrary real constant, 0

  Determine the equation for the quadratic function

Determine the equation for the quadratic function whose vertex and point is given. The vertex is (1,4) and the y-intercept is (0,3).

  Intellectual reaction to problems of the times

Some historians hold that economic theory can be explained as an intellectual reaction to problems of the times.

  Apply tracert command on windows

Apply tracert command on Windows to 74.125.21.100. Report the result, including screenshot or copy/paste your traceroute output.

  Major pros and cons of dsl and cable internet connection

From the second e-Activity, examine the major pros and cons of a DSL and a cable Internet connection. Compare DSL and cable Internet connections based on availability, consistent high speed, reliability, security, and price. Determine the Internet..

  E-commerce web site

Final project will be a Java programming project that uses design patterns to help form a dynamic Web database application. Final Project:  e-commerce Web Site

  Identify a new use for ugc

Choose one of the two publications and identify a new use for UGC. Write a one-page memo to the publisher of that magazine describing your idea and how it would contribute to the goals of the publication.

  Brand of oatmeal for breakfast for one month

The decrease in cholesterol level after eating a certain brand of oatmeal for breakfast for one month in people with cholesterol levels over 200

  What is the name of the keyboard

research the Internet and find out all that you can about the keyboard layout that you are using. Then write me a one page essay on what you found.

  Statement of comprehensive income

Given the statement of financial position, statement of comprehensive income and the industry average ratios answer the questions that follow. Assume all sales are on credit and 365 days.

  What is the current value of the lease

Payments are due on the first day of each month starting with the day you sign the lease contract. If your cost of money is 5.45 percent

  Investigate the difference that would be made

The momentum constant α is normally assigned a positive value in the range 0 α ≤ 1. Investigate the difference that would be made in the behavior of Eq. (4.43) with respect to time t if α were assigned a negative value in the range -1 ≤ α

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