# python3python
# 基本輸入輸出web
#學會使用split()的使用是關鍵,input()的返回值必定是字符類型app
.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-spa
1 # Example Input 2 # 1 5 3 # Example Output 4 # 6 5 6 a = [] 7 for x in input().split(): 8 a.append(int(x)) 9 print(sum(a))
直接一行輸出code
1 print(sum(int(x) for x in input().split()))
.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-orm
1 # Example Input 2 # 1 5 3 # 10 20 4 # Example Output 5 # 6 6 # 30 7 8 while True: 9 line = input() 10 if line: 11 print(sum(int(x) for x in line.split())) 12 else: 13 break
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-blog
1 # Example Input 2 # 2 3 # 1 5 4 # 10 20 5 # Example Output 6 # 6 7 # 30 8 9 N = int(input()) 10 while(N): 11 print(sum(int(x) for x in input().split())) 12 N -= 1
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-ci
1 # Example Input 2 # 1 5 3 # 10 20 4 # 0 0 5 # Example Output 6 # 6 7 # 3 8 9 while True: 10 a = [] 11 for x in input().split(): 12 a.append(int(x)) 13 if a[0] == a[1] == 0: # 以0 0結束 14 break 15 print(sum(a))
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-input
1 # Example Input 2 # 4 1 2 3 4 3 # 5 1 2 3 4 5 4 # 0 5 # Example Output 6 # 10 7 # 15 8 9 while True: 10 a = [] 11 line = input() 12 for x in line.split(): 13 a.append(int(x)) 14 if a[0] == 0: 15 break 16 print(sum(a)-a[0])
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-it
1 # Example Input 2 # 4 3 # 1 2 3 4 4 # 5 5 # 1 2 3 4 5 6 # 0 7 # Example Output 8 # 10 9 # 15 10 11 while(int(input())): 12 print(sum(int(x) for x in input().split()))
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
1 # Example Input 2 # 2 3 # 4 1 2 3 4 4 # 5 1 2 3 4 5 5 # Example Output 6 # 10 7 # 15 8 9 N = int(input()) 10 while N: 11 a = [] 12 line = input() 13 for x in line.split(): 14 a.append(int(x)) 15 print(sum(a)-a[0]) 16 N -= 1
這些基礎部分輸入輸出僅供參考、歡迎交流