In python, there are three types of errors; syntax errors, logic errors and exceptions.
You may like the following posts:
Syntax Errors in Python
You may like the following posts:
Syntax Errors in Python
List
|
Tuple
|
The elements of a list are mutable
|
elements of a tuple
are immutable
|
When we need to change the data in
future, list would be a right data type.
|
When we do not want
to change the data over time, the tuple is a preferred data type
|
When we are iterating (in looping
statements) elements, performance is slow
|
Iterating over the
elements of a tuple is faster .
|
The elements of list are enclosed in square bracket.
Ex: a=[10,20,30,40]
|
Elements of a tuple
are enclosed in parenthesis
Ex: a=(10,20,30,40)
|
Operator
|
Example
|
Meaning
|
Output
|
and
|
X and y
|
If x is ‘false’, it returns x, otherwise, it returns y
|
1 and 2= 2
|
Or
|
X or y
|
If x is false, it returns y, otherwise, it returns x
|
1 or 2= 1
|
Not
|
not x
|
If x is false, it returns True, otherwise False
|
Not True=False
|
Opearators
|
Example
|
Meaning
|
Output
|
And
|
a and b
|
If both a and b are True, then it returns True
|
False
|
Or
|
a or b
|
If either a or b is True, then it returns True, else false
|
True
|
Not
|
not x
|
If x is True, it returns False
|
False
|
#Ask the user to take two input integer values var a,b try: a=int(input("enter any integer value:")) b=int(input(&qu...