+ 1

Python range()

Could someone explain me how this code print in reverse? https://code.sololearn.com/cJ4i7Qrm94QN/?ref=app

17th Aug 2018, 4:45 PM
nurettin asd
nurettin asd - avatar
3 Antworten
+ 9
range(start,end+1,steps) is the syntax for range. Here your range starts from 15 and goes down to -1+1 i.e down to 0. -1 signifies the step.Negative indicates you are going 1 step backward
17th Aug 2018, 5:00 PM
Mitali
Mitali - avatar
+ 1
When you use range() with 3 parameters the syntax is this: range(start,stop,step) start defines the starting point of the sequence. stop defines the final number of the sequence excluding itself. step defines the rate at which the counter changes. In your code the value of i begins at 15 (start) it ends at 0 (stop value -1 is not included) and it changes by -1 (step).
17th Aug 2018, 5:08 PM
avg555
0
hi mithali this is my contact number <removed> would you please call me I do have many doubts to ask you Anil Kumar *Avoid sharing/asking personal info like mobile/email in a public forum. *It can be misused.
20th Aug 2018, 4:01 AM
Anil Kumar
Anil Kumar - avatar