m = int(input())
for i in range(m):
x = int(input())
if 0 <= x < 2:
print("y=%.1f" %(-x+2.5))
elif 2 <= x < 4:
print("y=%.1f" %(2-1.5*(x-3)*(x-3)))
elif 4 <= x < 6:
print("y=%.1f" %(x/2-1.5))
反序输出
while True:
try:
x = input()
for i in range(len(x)):
print(x[len(x) - i - 1], end = "")
except:
break
print()
成绩排序
temp = []
N = int(input())
for i in range(N):
temp.append(input().split())
temp[i][1],temp[i][2] = int(temp[i][1]),int(temp[i][2])
temp.sort(key=lambda x:(x[2],x[0],x[1]))
for i in range(N):
for j in range(3):
print(temp[i][j],end=" ")
print()
查找
while True:
try:
a,b,c,d = input(),list(map(int,input().split())),input(),list(map(int,input().split(