- Please don't use ()
- Never forget the
:
at the end of the line
Check this code:
x, y = 1, 2
if x > y:
print 'x is greater'
for
iterates over a sequence- Never forget the
:
at the end of the line
Check this code:
numbers = [1, 2, 3, 4, 5,]
for number in numbers:
print number
while
is likeif
, but executes while the codition isTrue
- please don't use ()
- never forget the
:
at the end of the line
Check this code:
from random import randint
args = (1, 10,)
x = randint(*args)
while x != 6:
x = randint(*args)