In this code, I wanted to make a dictionary that would contain the encrypted version of a string. however, at the first if statement, the code seems to skip over both if statements and do not understand why
8 import string
9
10
11 drunk="abcdefABC"
12 joe={}
13 shift=4
14 for i in drunk:
15 for j in string.ascii_lowercase:
16 listj=[]
17 listj.append(j)
18 for x in string.ascii_uppercase:
19 listx=[]
20 listx.append(x)
21 if i in listj:
22 tempvara=ord(i)
23 tempvarb=chr(tempvara+shift)
24 joe[i]=tempvarb
25 if i in listx:
26 vartempa=i.lower()
27 vartempb=ord(i)
28 vartempc=chr(vartempb+shift)
29 vartempc=vartempc.upper()
30 joe[i]=vartempc
31 print(Joe)
Coded in Python
Aucun commentaire:
Enregistrer un commentaire