Skip to content

Commit 14ce04f

Browse files
authored
Update main.py
Signed-off-by: de_soot <[email protected]>
1 parent 5dd5b95 commit 14ce04f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

main.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,28 @@
1010
char_unicode_old = ord(char)
1111

1212
# checks if it is an uppercase letter or a lowercase letter or a number
13-
upper = char_unicode_old >= 65 and char_unicode_old <= 90
14-
lower = char_unicode_old >= 95 and char_unicode_old <= 122
15-
number = char_unicode_old >= 48 and char_unicode_old <= 57
13+
upper = char_unicode_old >= 65 and char_unicode_old <= 90
14+
lower = char_unicode_old >= 95 and char_unicode_old <= 122
15+
number = char_unicode_old >= 48 and char_unicode_old <= 57
1616

1717
# does nothing if it the character is not a letter or number
1818
char_unicode_new = char_unicode_old + (encryption_key * (upper or lower or number))
1919

2020
# makes unicode only be in between 65 - 90 (A - Z) if the original character was an uppercase letter
2121
char_unicode_new += upper * ((91 - ((65 - char_unicode_new) % 26) - char_unicode_new) * (char_unicode_new < 65))
22-
char_unicode_new += upper * (65 + ((char_unicode_new - 65) % 26) - char_unicode_new) * (char_unicode_new > 90)
22+
char_unicode_new += upper * ( 65 + ((char_unicode_new - 65) % 26) - char_unicode_new) * (char_unicode_new > 90 )
2323

2424
# makes unicode only be in between 97 - 122 (a - z) if the original character was a lowercase letter
25-
char_unicode_new += lower * (123 - ((97 - char_unicode_new) % 26) - char_unicode_new) * (char_unicode_new < 97)
26-
char_unicode_new += lower * (97 + ((char_unicode_new - 97) % 26) - char_unicode_new) * (char_unicode_new > 122)
25+
char_unicode_new += lower * (123 - ((97 - char_unicode_new) % 26) - char_unicode_new) * (char_unicode_new < 97 )
26+
char_unicode_new += lower * (97 + ((char_unicode_new - 97) % 26) - char_unicode_new) * (char_unicode_new > 122)
2727

2828
# makes unicode only be in between 48 - 57 (0 - 9) if the original character was a number
29-
char_unicode_new += number * (58 - ((48 - char_unicode_new) % 10) - char_unicode_new) * (char_unicode_new < 48)
30-
char_unicode_new += number * (48 + ((char_unicode_new - 48) % 10) - char_unicode_new) * (char_unicode_new > 57)
29+
char_unicode_new += number * (58 - ((48 - char_unicode_new) % 10) - char_unicode_new) * (char_unicode_new < 48 )
30+
char_unicode_new += number * (48 + ((char_unicode_new - 48) % 10) - char_unicode_new) * (char_unicode_new > 57 )
3131

3232
message_encrypted += chr(char_unicode_new)
3333

3434
print("Encrypted message : " + message_encrypted)
3535

3636
user_input = input("\tPress enter to continue encrypting messages. Enter 'quit' to exit the program\n>>> ")
37+

0 commit comments

Comments
 (0)