In computer programming languages operators are special symbols which represent computations,
conditional matching etc. The values the operator uses are called operands.
Python supports following operators:
Arithmetic Operators
Comparison Operators
Logical Operators
Assignment Operators
Bitwise Operator
Conditional Operators
The best way to learn new things is to take a practical approach of the things you want to learn. Here is a fragment of code that demonstrates the use of the operators statement in Python:
The best way to learn new things is to take a practical approach of the things you want to learn. Here is a fragment of code that demonstrates the use of the operators statement in Python:
Æ’ python command
print([1,2,3] * 3)
number = 5 + 1 * 3 / 2.0
print(number)
remainder = 14 % 7
print(remainder)
squared = 2 ** 4
print(squared)
cubed = 2 ** 2
print(cubed)
iamthebest = ‘I am’ + ‘ ‘ + ‘the
best’
print(iamthebest)
wasaup = ‘bla’ * 5
print(wasaup)
even_numbers = [2,4,6,8]
odd_numbers = [1,3,5,7]
all_numbers = odd_numbers +
even_numbers
print(all_numbers)
√ output
[1, 2, 3, 1, 2, 3, 1, 2, 3]
6.5
0
16
4
I am the best
blablablablabla
[1, 3, 5, 7, 2, 4, 6, 8]
Sign up here with your email
ConversionConversion EmoticonEmoticon