![]() In a game, points were won and lost, represented by integers. Answer: In order to find the range, we have to arrange the above data set in ascending. Example 3: Find out the range for the following data set: 9, 9, 9, 9, 2, 2, 5, 5, 5, 4, 8, 8, 8, 7 and 7. 1.įind the range of these distances run by 6 marathon runners:įind the range of these race times given in seconds:ħ.3 s, 8.4 s, 8.0 s, 7.5 s, 9.4 s, 8.7 s, 9.1 sĮmployees at a retail store are paid the hourly wages listed below. According to the formula for range, Range Highest value Lowest value 95 50 45 Hence, 45 is the range of Alice’s marks across 8 subjects. After you click ENTER, a message will appear in the RESULTS BOX to indicate whether your answer is correct or incorrect. Then subtract the smallest value from the largest value in the set.ĭirections: Click once in an ANSWER BOX and type in your answer then click ENTER. To find it, first order the data from least to greatest. Summary: The range of a set of data is the difference between the highest and lowest values in the set. Highest - lowest = 8.3 hr - 2.7 hr = 5.6 hr What is the range of times given in hours below? Highest - lowest = 19 -12 = 19 + +12 = +31Įxample 3: A marathon race was completed by 5 participants. Kaiser listed 9 integers on the blackboard. Solution: Ordering the data from least to greatest, we get:Įxample 2: Ms. Gasoline prices varied from state to state. Let's take a closer look.Įxample 1: The Jaeger family drove through 6 midwestern states on their summer vacation. This is especially important with large sets of data. In the examples below, our first step is to order the data from least to greatest. trying to do it manually with a negative increment.Definition: The range of a set of data is the difference between the highest and lowest values in the set. If you want to loop over the index numbers of a string or list backwards, it's easier to use reversed() above, vs. > list(range(4, 5, -2)) # beyond the stop is omitted > list(range(5, 5, -2)) # equal to stop is omitted As always, numbers reaching or beyond the stop are omitted, but now step is decreasing. If the step is negative, the range decreases from start down to stop. As before, the stop number itself is always omitted. Once the number is equal or goes beyond the stop, the range ends. The difference is the "step" amount between numbers is now custom. The 3 parameter form begins with start number, up to but no including the stop number as usual. Range(start, stop, step) - 3 Parameter Form Mnemonic: the "stop" number is strong, so as soon as the numbers hit or exceed the stop the range is done (even if the start number initiates things in that position). > list(range(5, 5)) # start >= stop, no numbers ![]() ![]() Range with 2 parameters specifies a start number other than 0, but is otherwise like the 1 parameter form above, going up to but not including the stop number. This works nicely with range() to go over the regular numbers in reverse order: Range is a concept in math, which is defined as the difference of the highest and the lowest number in data.For example, you have the averages of the number of ants per square foot in several areas:87156223504337If you arrange it from lowest to highest, it will be easier to solve for the range. ![]() The reversed() function takes in a linear collection and returns a reversed form of it. Probably the second most common problem is to go through the standard index numbers, but in reverse order. What is range(0)? Well range(n) returns n numbers, so this case returns no numbers at all - like the empty list. This use of list() is only for printing, not needed to use range() in a loop. For cosmetic reasons in the examples below, the call of the range() function is inside a list() so the numbers will print out. This is perfect for generating the index numbers into, for example, a string.īelow are some more examples calling range(). Or put another way, range(n) returns a series of n numbers, starting with 0`. The most common form is range(n), for integer n, which returns a numeric series starting with 0 and extending up to but not including n, e.g. The range() function can be called in a few different ways. This is very useful, since the numbers can be used to index into collections such as string. The python range() function creates a collection of numbers on the fly, like
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |