Computer Science, asked by poojasri2004, 10 months ago

Use the python range() function to create the following list :[7,3,-1,-5]

Answers

Answered by sriyadamera0407
12

Answer:

for x in range(7,-6,-4):

   print(x)

HOPE THIS ANSWER WILL HELP YOU!!!

Answered by Qwdubai
2

x = range(7, -9, -4)

  • The range() function in python returns a specific set of numbers starting from the given number with an increment by "step" and ends before the specified number.
  • The syntax for range() function is:

range(start, end, step)

  • The range given in the sequence needs a decrement by 4. Therefore, in "step" we will put -4.
  • We need to print the sequence till -5 so, we will put the end number as -9.

Given below is the program:

x = range(7, -9, -4)

for n in x:

 print(n)

#SPJ3

Similar questions