In c we use for(i=0;i<5;2*i+1) then how can write in for loop of python using 2*i+1. We cann't use this condition | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In c we use for(i=0;i<5;2*i+1) then how can write in for loop of python using 2*i+1. We cann't use this condition

sir in general we use in increment decrement operator i++ or i-- or simply we can write i+2 and in python we simply use python for i in range(2,1) where 2 increment 1 times because we write 1 in the range part if I write 2 in the replace of 1 then the 2 increment +2 but in c language when we 2*I+1 increment then what we can write syntax in for loop of python. please reply fast sir

18th Nov 2017, 4:01 PM
ayush raj
ayush raj - avatar
4 Answers
+ 1
The range() function takes 3 arg.: start pos., end pos. and increment step i = 1 for i in range(0, 20, i * 2 + 1): print(i)
18th Nov 2017, 5:11 PM
Boris Batinkov
Boris Batinkov - avatar
0
sir but how can I write syntax in python
18th Nov 2017, 4:30 PM
ayush raj
ayush raj - avatar
0
sir you don't what I want to talk to you how can write thi 2*I+1 in Python for loop we can't write like for I in range(2,3,2*I+1): because its simple write I is not defined
18th Nov 2017, 4:33 PM
ayush raj
ayush raj - avatar
0
but if value of i is change during loop that cannot follow its always starting with I=1
18th Nov 2017, 5:36 PM
ayush raj
ayush raj - avatar