0
What is the use of the ord() function?
I've looked it up and still don't seem to understand, it's stated that it returns the integer value of the character or something... maybe someone can give a simple example where it is used
4 ответов
+ 1
https://docs.python.org/3/library/functions.html#ord
Yes it returns an integer value represent the character in unicode.
Why would anyone use this, because its easier to calculate this way for cipher or something else.
https://code.sololearn.com/cI6l7LCedFXW/?ref=app
here i use those value to modify each character binary using another as reference on how much should i shift its binary.
0
Taste I don't really understand the output of your code, maybe after reading on binary shifting, I might understand
0
Simpler example will be caesar cipher
for i in range(len(txt)):
c=ord(txt[i])+ord(key)
if(c>ord('z')):
c=ord('a')+(c-ord('z')+1)
print(chr(c))
0
I have a little understanding now Taste , and you opened me up to another world (cryptography), thank you