0

I am new to python and currently working in it. I have write one simple program, as i read somewhere that semicolon not allowed or required in python to end statement. but i have use that and till its working fine! anyone explain me

why its possible?

here is code.

a = 10;
if a == 10:
    print "value of a is %s"%(a);
else:
    print "value of a is not %s"%(a);

2 Answers2

2

semicolon is allowed as statement separator

>>> a=1;b=2;c=3
>>> print(a,b,c)
1 2 3

It is not required if you write each statement in a new line

napuzba
  • 6,033
  • 3
  • 21
  • 32
0

Python does not require semi-colons to terminate statements. Semi-colons can be used to delimit statements if you wish to put multiple statements on the same line.

ashvin
  • 135
  • 7