PAT乙级练习(Python)
1. PAT-B 1001. 害死人不偿命的(3n+1)猜想 (15)
n = 0
a = int(input(''))
while a!= 1:
if(a%2==1):
a = (3*a+1)/2
n += 1
else:
a = a/2
n += 1
print(n)
2.PAT-B 1009. 说反话 (20)
print(" ".join(input().split()[::-1]))
3.PAT-B 1002. 写出这个数 (20)
L = ['ling', 'yi','er', 'san', 'si', 'wu', 'liu', 'qi', 'ba', 'jiu']
a = sum(list(map(int, input())))
list_test = []
for i in str(a):
list_test.append(L[int(i)])
for j in range(0, len(list_test)):
if j == len(list_test)-1:
print(list_test[j], end="")
else:
print(list_test[j], end=" ")