+1 vote
209 views
int j=0;

int i=0;

for(i=0;j<5;i++)

{

if(i%2==0)

j++;

}
Category
edited Aug 18, 2015 | 209 views

In the loop if you notice the value of j and i is initially 0 .

You could loop using :

for i in range(0, 5):                     #Loop statement with proper indention
print "We're on time %d" % (x)        #printing value in x

Secondly if you need to check using if condition the syntax is below :

i =11               # Some value
if i % 2 == 0:      # modulus operator

print 'ok'
else :
print 'cannot divide'

Hope you are clear about the syntax in Python ,just give a try on online IDEs available .

Edit 1 :

Yes you can check with another variable using if condition after the for syntax.

More find at Python Doc