External Exam Download Resources Web Applications Games Recycle Bin

encryption basics 1

encryption_basics1.py

# https://home.unicode.org/ - the standard for the
# consistent encoding, representation, and handling
# of text expressed in most of the world's writing systems.

# ord() returns an integer representing the Unicode character:
number = ord("A")
print(number) #prints 65

# chr() returns the character representing the Unicode integer:
letter = chr(65)
print(letter) #prints 'A'

# // - floor division operator:
print(9 // 4) #prints 2

# % - modulo operator (also known as remainder division):
print(9 % 4) #prints 1

# quick way of doing div and mod in one line:
x,y = divmod(9,4)
print(x) #gives the floor division (2)
print(y) #gives the remainder of the division (1)