-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcesarchiffre.py
More file actions
43 lines (35 loc) · 852 Bytes
/
cesarchiffre.py
File metadata and controls
43 lines (35 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'''
This program will take a string and and an integer.
The String will be encrypted with the Cesar-Cipher.
The characters of the String will be replaced by other chars
that are in the place in the alphabet the given integer suggests.
'''
# vars
sentence = ""
cipherInt = 0
# funcs
def getSentence():
global sentence
print('Enter a sentence to be encrypted: \n')
sentence = input(": ")
sentence = sentence.lower()
def getCipherInt():
global cipherInt
print('Enter a number encrypt with: \n')
cipherInt = input(": ")
def encrypt():
print("Before: ")
print(sentence)
print(cipherInt)
for char in sentence:
char += cipherInt
print(char)
print("After: ")
print(sentence)
# main-loop
def main():
getSentence()
getCipherInt()
encrypt()
# calling main func
main()