Vous êtes sur la page 1sur 1

Knowledge is Strength Knowledge is Strength Knowledge is Strength Knowledge is Strength Knowledge is

Strength General Certificate of Education (Advance Level) Examination


Information and Communication Technology A n u r a B a n d a r a 20 S

Python language supports following type of operators.

1. Arithmetic Operators
2. Comparison Operators
3. Logical (or Relational) Operators
4. Assignment Operators
5. Conditional (or ternary) Operators

Operator precedence

Operator Description
** Exponentiation (raise to the power)
~ Complement
* / % // Multiply, divide, modulo and floor division
+ - Addition and subtraction
>> << Right and left bitwise shift
& Bitwise 'AND'
^ | Bitwise exclusive `OR' and regular `OR'
<= < > >= Comparison operators
<> == != Equality operators
= %= /= //= -= += *= **= Assignment operators

Example

1. පහත සඳහන් python ප්රsකා඾ ඇගයීමේ නිලැරදි පටිපාටිය ලියා ඒලාමේ සුළුකරන ඼ද පිළිතුර ඼බාගන්න.

i. 20+2**3-8
ii. 10+2*5/4
iii. 25*2**2//3+2
iv. 9.0/4*2**3%3
v. 2**3>>2
2. පහත සඳහන් python ප්රsකා඾යන්හි සුළුකරන ඼ද පිළිතුර ඼බාගන්න.

i. ~45
ii. 25&33
iii. 2**5|12

Vous aimerez peut-être aussi