- 5
How many arguments are in this function call? range(0, 100, 5)
How many arguments are in this function call? range(0, 100, 5)
13 Réponses
+ 3
The second parameter is the upper limit (in this case = 100), but 100 is not included. so if you run this code:
for i in range(0,10):
print(i, end=', ')
# output is: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
So if the upper limit has to be included you have to say:
for i in range(0,10 + 1):
print(i, end=', ')
# output is: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
+ 3
3
+ 1
ISN'T THE ARGUMENT'S ARE 0(START), 100(STOP) & 5(STEP) ?
BECAUSE THE PROGRAM WILL RUN LIKE 0, 5, 10, 15, 20 TILL 95 .
ANYONE, LET ME KNOW I AM WRONG OR RIGHT PLEASE .
+ 1
its 3 as they are asking for arguments but the list of numbers
0
There are 3 arguments in your call to range, 0, 100 and 5. So the function goes from 0 to 100 (not included) with a step size of 5.
So the series you will get is 0,5,10,15 and so on till 95.
Edit: Apologies for the incorrect information earlier.
0
How many arguments are in this function call? range(0, 100, 5
- 1
There are total of 3 arguments.
- 1
there are 3
- 1
3
- 1
3
- 1
3
- 3
There are total of 3 arguments.
- 13
How many arguments are in this function call?
range(0, 100, 5)