• Python第二周作业


    inp=input()
    l=len(inp)
    
    for i in range(l):
        if ord('A') <=ord(inp[i])<=ord('Z'):
            onew=ord('A')+((ord(inp[i])-ord('A'))+3)%26
        elif ord('a') <=ord(inp[i])<=ord('z'):
            onew=ord('a')+((ord(inp[i])-ord('a')) + 3 )%26
        else:
            onew=ord(inp[i])
        new=chr(onew)
        print(new,end='')
    凯撒密码B
    str=input("")
    left=0
    for i in str:
        if i == "(":
            left += 1
        elif i == ")":
            if left > 0:
                left -= 1
            else:
                print("配对不成功")
                break
    else:
        if left != 0:
            print("配对不成功")
        else:
            print("配对成功")
    括号配对检测
    a=eval(input(""))
    b=pow((1.0+0.001*a),364)
    c=pow((1.0-0.001*a),364)
    d=int(b//c)
    print("{:.2f}, {:.2f}, {}".format(b,c,d))
    天天向上的力量B
    N=eval(input())
    a=abs(N)
    if N<0:
        b=-abs(a+10)
        c=-abs(a-10)
        d=-abs(a*10)
    else:
        b=abs(a+10)
        c=abs(a-10)
        d=abs(a*10)
    print(a,int(b),int(c),int(d),end="")
    同符号数学运算
    n=eval(input())
    
    while n!=1 and n!=4:
    
        num=list(str(n))
    
        n=0
    
        for i in num:
    
            n+=int(i)**2
    
    if n==1:
    
        print("True")
    
    else:
    
        print("False")
    快乐的数字
    n = input() 
    for i in n: 
            if ord("a") <= ord(i) <= ord("z"): 
                print(chr(ord('z')-(ord(i)-ord('a'))),end='') 
            elif ord("A") <= ord(i) <= ord("Z"): 
                print(chr(ord('Z')-(ord(i)-ord('A'))),end='') 
            else: 
                print(i,end='')
    字符串反码A
    a=eval(input())
    b=eval(input())
    print(round(a*b,2))
    计算矩形面积
    a=eval((input()))
    print("{:.3f}".format(a))
    格式化输出
    s=input()
    
    def str_reverse1(s):
    
        return s[::-1]
    
    if __name__ == '__main__':
    
        rs = str_reverse1(s)
    
        print(rs)
    字符串逆序输出
    a = int(input()) 
    b = 1     
    for i in range(1, a+1):  
        b = b*i  
    print("{}".format(b)) 
    照猫画虎求阶乘
  • 相关阅读:
    三国演义中的十大谎言 VS 程序员十大口头禅
    Node.js 的单线程事件驱动模型和内置的线程池模型
    为了让医院把医护还给患者,他们用了这个…
    华为云数据库内核专家为您揭秘:GaussDB(for MySQL)并行查询有多快?
    brew
    Python
    Python
    Python
    AtCoder Beginner Contest 215 (个人题解 A~F)
    AcWing 第 13 场周赛  补题记录
  • 原文地址:https://www.cnblogs.com/yeluozhiqiumax/p/12563771.html
Copyright © 2020-2023  润新知