我叫武炜昊 发表于 2021-12-19 20:28:58

oho{:10_257:}

claude123 发表于 2021-12-28 15:37:04

强强强强强强强强强强

与森逐鹿 发表于 2022-1-22 18:05:37

text = input("请输入明文: ")
secret = ""
i = 0
while i < len(text):
    c = text
    if ("a"<=c<='w') or ('A' <= c <= 'W'):
      c = chr(ord(c)+3)
    elif ('x'<=c<='z') or ('X'<= c <='z'):
      c = chr(ord(c) +23)
    secret = secret + c
    i += 1

print(secret)


decode = input('请输入密文: ')
order = ''
m = 0
while m < len(decode):
    n = decode
    if ('d'<=n<='z') or ('D' <= n <= 'Z'):
      n = chr(ord(n)-3)
    elif ('a'<=n<='c') or ('A' <= n <= 'C'):
      n = chr(ord(n)-23)
    order = order + n
    m+=1
print(order)

hornwong 发表于 2022-1-23 23:09:36

{:5_95:}

zien.dou 发表于 2022-1-24 15:02:46

1111

张亚当 发表于 2022-2-8 14:25:44

s=input('输入')
y=['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','b','c','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','B','C']
print("译文是", end="")
for a in s:
   if a in y:
      n=y
      print(n,end="")
    else:
      print(a,end="")

weizyu 发表于 2022-2-10 12:49:05

{:7_146:}

埃普斯先生 发表于 2022-2-10 21:31:41

看看看看

frankz 发表于 2022-2-21 10:48:55

流程图

小五亦生 发表于 2022-2-23 20:19:57

1

CG2022 发表于 2022-3-2 10:42:09

每日学习{:10_254:}

boboboiz 发表于 2022-3-7 11:13:24

nnn

Hyjxsssss 发表于 2022-5-5 21:39:53

# 题干
# 用英文输入一句话,只加密字母,加密规则是:
# 将字母 A 换作字母 D,B 变成 E……以此类推 X 将变成 A,Y 变成 B,Z 成 C。
# 加密时区分字母的大小写。



strings = input('请输入密码:')
strout = ''
Delta = ord('Z') - ord('A')
for eachcode in strings:
    if eachcode.isupper():
      if ord(eachcode) in range(ord('A'), ord('X')):
            eachcode = chr(ord(eachcode) + 3)
      elif ord(eachcode) in range(ord('X'), ord('Z')+1):
            eachcode = chr(ord(eachcode) - Delta)
    if eachcode.islower():
      if ord(eachcode) in range(ord('a'), ord('x')):
            eachcode = chr(ord(eachcode) + 3)
      elif ord(eachcode) in range(ord('x'), ord('z')+1):
            eachcode = chr(ord(eachcode) - Delta)
    else:
      pass
    strout += eachcode
print('解密后的密码为:%s' % strout)

qq274996779 发表于 2022-6-22 17:25:09

反义
secret = input('请输入一句密文:')
text = []
i = 0
while i < len(secret):
    c = secret
    if 'd' <= c <= 'z' or 'D' <= c <= 'Z':
      c = chr(ord(c) - 3)
    elif 'a' <= c <= 'c' or 'A' <= c <= 'C':
      c = chr(ord(c) + 23)
   
    text.append(c)
    i += 1
print('明文为:', end='')
for j in text:
    print(j, end='')

夜兰丶希露 发表于 2022-6-23 16:06:11

{:10_254:}

憨憨学py 发表于 2022-7-22 15:09:49

s = input("请输入要加密的明文:")
stack = []
for c in s:
    if 64 < ord(c) < 88 or 96 < ord(c) < 120:
      stack.append(chr(ord(c) + 3))
    elif 87 < ord(c) < 91 or 119 < ord(c) < 123:
      stack.append(chr(ord(c) - 23))
    else:
      stack.append(c)
print(''.join(stack))

gh12345 发表于 2022-7-22 15:45:52

学习

鱼不可及 发表于 2022-10-12 20:29:17

厉害

张金泉 发表于 2022-11-11 11:50:43

{:5_106:}

cn1in 发表于 2022-11-11 23:31:53

text = input('请输入明文吧:')
secret = ''
i = 0
while i <len(text):
    c = text
    if 'a'<=c<='w' or 'A'<= c <= 'W':
      c = chr(ord(c)+3)
    elif 'x'<= c <= 'z' or 'X' <= c<= 'Z':
      c = chr(ord(c)-23)
    secret = secret +c
    i = i+1
print(f'密文:{secret}\n请务必一个人偷偷看')
页: 1 [2] 3
查看完整版本: 10 - 凯撒加密的奥义