Computer Science, asked by daleisipranjali, 4 months ago

Write range function to generate following sequence-

a. [1,2,3,4,5,6,7,8,9]

b. [10,13,16,19,22]​

Answers

Answered by allysia
32

Using python:

a.

\\\tt for\ i\ in \ range (1,10): \\\tt {\qquad print(i)}

b.

\\\tt for\ i\ in \ range (10,22+1, 3): \\\tt {\qquad print(i)}

Explanation:

  • range(a,b,c) returns numbers beginning from a to (b-1) and with a gap of c.
  • range(a,b) is valid and the gap between the numbers is automatically accepted as 1.


sainiinswag: Great effort
rawatshubhi525: fcking
Similar questions