NowCoder Girl highlights problems

1.Python deal with continuing input:

Not a problem given input value, the biggest difficulty is how to determine when to terminate. Today saw several big kill. Share with:

import sys
for line in sys.stdin.readlines():
    a, b = map(int, line.split(" "))
    print(a + b)


import sys
 
 
for line in sys.stdin:
 
 
     data = map( int , line.split())
 
 
     print(sum(data))

while True: try: ss=input().split(" ") print(int(ss[0])+int(ss[1])) except EOFError: break while True: try: a, b = input().split() print(int(a) + int(b)) except: break
#include <iostream> using namespace std; int main (){ int a,b; while(cin>>a>>b) cout<<(a+b)<<endl; return 0; }

 

Guess you like

Origin www.cnblogs.com/Marigolci/p/11996411.html