Important terms in Python
Link will be apear in 15 seconds.
Well done! you have successfully gained access to Decrypted Link.
Statement
A statement is an instruction that the Python interpreter can
execute.
•
When
you type a statement on the command line, Python executes it and displays the
result, if there is one.
•
A
script usually contains a sequence of statements. If there is more than one
statement, the results appear one at a time as the statements execute.
•
An
expression is a combination of values, variables, and operators.
•
If
you type an expression on the command line, the interpreter evaluates it and
displays the result:
•
>>>
1 + 1
•
2
•
A
value all by itself is considered an expression, and so is a variable.
Simultaneous
Assignment:
•
Python
also supports simultaneous assignments like this:
•
var1,var2…………..,varn=exp1,exp2…………….,expn
•
>>> a,b,c=4,5,6
•
>>> a
•
4
•
>>> b
•
5
•
>>> c
•
6
Example
of simultaneous assignment:
Write code to swap two numbers.
>>>X=1
>>>Y=3
>>>Temp=X
>>>X=Y
>>>Y=Temp
Can be written as:
>>>X=1
>>>Y=3
>>>X,Y=Y,X