a =
['a'
,'b'
,'c'
,'d'
,'e'
,'f'
,'g'
,'h'
,'i'
,'j'
,'k'
,'l'
,'m'
,'n'
,'o'
,'p'
,'q'
,'r'
,'s'
,'t'
,'u'
,'v'
,'w'
,'x'
,'y'
,'z'
]a =
input()
for i in a:
if i in a:
b = a[
(ord
(i)-
ord(
'a')+3
)%26]
elif i.upper(
)in a:
b = a[
(ord
(i)-
ord(
'a')+3
)%26]
.lower(
)else
: b = i
print
(b,end=
'')
摘自:
(侵刪哈~)
def
encryption
(str
, n)
: cipher =
for i in
range
(len
(str))
:ifstr[i]
.islower():
iford
(str
[i])
<
123-n:
c =chr(
ord(
str[i]
)+ n)
else
: c =
chr(
ord(
str[i]
)+ n -26)
elif
str[i]
.isupper():
iford
(str
[i])
<
91-n:
c =chr(
ord(
str[i]
)+ n)
else
: c =
chr(
ord(
str[i]
)+ n -26)
else
: c =
str[i]
cipherstr =(''
).join(cipher)
return cipherstr
#獲得使用者輸入的明文
plaintext =
input()
ciphertext = encryption(plaintext,3)
print
(ciphertext)
def
encryption
(str
, n)
: cipher =
for i in
range
(len
(str))
:ifstr[i]
.islower():
#該字母為小寫字母
c =chr(
ord(
'a')+(
ord(
str[i])-
ord(
'a')
+ n)%26
)elif
str[i]
.isupper():
c =chr(
ord(
'a')+(
ord(
str[i])-
ord(
'a')
+ n)%26
)else
: c =
str[i]
cipherstr =(''
).join(cipher)
return cipherstr
#獲得使用者輸入的明文
plaintext =
input()
ciphertext = encryption(plaintext,3)
print
(ciphertext)
以下方法引用自:
據說是標答(侵刪)
s =
input()
t =""
for c in s:
if'a'
<= c <=
'z':
#str是可以直接比較的
t +=
chr(
ord(
'a')+(
(ord
(c)-
ord(
'a'))+
3)%26
)elif
'a'<=c<=
'z':
t +=
chr(
ord(
'a')+(
(ord
(c)-
ord(
'a'))+
3)%26
)else
: t += c
print
(t)
以下方法引用自:
(侵刪)
a =
input()
for i in
range
(len
(a)):if
ord(
'a')
<
ord(a[i]
)<
ord(
'z')
: b =
ord(
'a')+(
ord(a[i])-
ord(
'a')+3
)%26elif
ord(
'a')
<
ord(a[i]
)<
ord(
'z')
: b =
ord(
'a')+(
ord(a[i])-
ord(
'a')+3
)%26else
: b =
ord(a[i]
) r =
chr(b)
print
(r,end=
'')
python密碼生成器的3種方法
coding utf 8 32 47 空格 48 57 0 9 58 64 65 90 a z 91 96 反斜槓 97 122 a z 123 126 import itertools import random from scipy.special import comb,perm這個方法比較方...
安裝LINUX的五種方法
安裝時候選擇 http設定 名 192.168.1.75 red hat 目錄 redhat 它會自動找到目錄並安裝,注意我用這種方式安裝有幾個包會壞掉,也不能跳過安裝,而且我的iso檢查了md5sum是好的,包名稱好象是 openoffice 86m大小,xmms方面的包還有幾個不記得了,所以不建...
python字串拼接的五種方法
python字串拼接常見方法如下 直接用 連線 這種方法超級醜陋,不建議用 這樣也有很大的安全隱患,最簡單的sql注入都防不住 a a b abcdefghijklmn c 12346579 連線的結果 print a b c aabcdefghijklmn12346579 字串模板 用 佔位符和引...