python第二次练习

2021-02-01 06:16

阅读:712

标签:alt   print   eva   orm   put   and   pytho   code   end   

Str = input("")
for i in Str: 
    if ord("a") "z"):
        print(chr(ord("a")+(ord(i)-ord("a")+3)%26),end=‘‘)
    elif ord("A") "Z"):
        print(chr(ord("A")+(ord(i)-ord("A")+3)%26),end=‘‘)
    else:
        print(i, end=‘‘)

 技术图片

Str=input("")
a=0
b=0
c=0
for i in Str:
    if i== (:
        a+=1
    elif i== ):
        if a>0:
            a-=1
        else:
            print("配对不成功")
            break
    elif i==[:
        b+=1
    elif i==]:
        c+=1
else:
    if a!=0:
        print("配对不成功")
    elif b!=c:
        print("配对不成功")
    else:
        print("配对成功")

技术图片

N = eval(input(""))/1000
dayup = pow(1+N,365)
daydown = pow(1-N,365)
compare = int(dayup/daydown)
print("{:.2f},{:.2f},{}".format(dayup,daydown,compare))

技术图片

n = eval(input())
N = abs(n)
a = N + 10
b = N - 10
c = N * 10
if n  0:
    a = -abs(a)
    b = -abs(b)
    c = -abs(c)
else:
    a = abs(a)
    b = abs(b)
    c = abs(c)
print(N, a , b, c)

技术图片

def getSumofSquares(num):
    numStr=str(num)
    sum=0
    for i in numStr:
        sum += int(i)**2
    return sum
def main():
    n = input()
    sumofSqrs = eval(n)
    while sumofSqrs != 1 and sumofSqrs != 4:
        sumofSqrs = getSumofSquares(sumofSqrs)
    else:
        if sumofSqrs == 1:
            print("True")
        else:
            print("False")
main()

技术图片

n=input()
for i in  n:
    if ord("a") "z"):
        print(chr(ord(z)-(ord(i)-ord(a))),end=‘‘)
    elif ord("A") "Z"):
        print(chr(ord(Z)-(ord(i)-ord(A))),end=‘‘)
    else:
        print(i,end=‘‘)

技术图片

python第二次练习

标签:alt   print   eva   orm   put   and   pytho   code   end   

原文地址:https://www.cnblogs.com/ssh-4016/p/12813905.html


评论


亲,登录后才可以留言!