Computer Science, asked by ruchibhargava663, 6 months ago

What values will be generated for the following range function:(a) range (5,15,3), (b) range (8,2,-1)​

Answers

Answered by h4hero2004p4r7sq
1

Answer:

Assuming the language is Python and range object is typecasted to list,

a) values = [5, 8, 11, 14]

b) values = [8, 7, 6, 5, 4, 3]

Explanation:

In Python, the range() function takes three parameters:

  1. Start (Inclusive)
  2. End (Exclusive)
  3. Step

The next number a_{2} in a range given previous value a_{1}, start value v, step s, and end value e will be,

a_{2}  = a_{1}  + s where a_{2}  < e

Similar questions