-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-2.py
More file actions
48 lines (39 loc) · 897 Bytes
/
test-2.py
File metadata and controls
48 lines (39 loc) · 897 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
44
45
46
47
48
spam = 42
def eggs():
spam = 99 # spam in this function is local
print('In eggs():', spam)
def ham():
print('In ham():', spam) # spam in this function is global
def bacon():
global spam # spam in this function is global
print('In bacon():', spam)
spam = 0
def CRASH():
print(spam) # spam in this function is local
spam = 0
#print(spam)
#eggs()
#print(spam)
#ham()
#print(spam)
#bacon()
#print(spam)
#CRASH()
text = 'Common sense is not so common.'
text = 'RDBBDC HTCHT XH CDI HD RDBBDC.'
key = 15
LENGTH = len(text)
A = ord('A')
Z = ord('Z')
ABC = ''
for i in range(A, Z + 1):
ABC += chr(i)
text = text.upper()
for count in range(1, LENGTH):
encrypted = ''
for letter in text:
if letter in ABC:
encrypted += chr(((ord(letter) - A - count) % 26) + A)
else:
encrypted += letter
print(count, encrypted)