2022年3月30日 星期三

用Python面對不限定個數的測資

<法一>

import sys
for s in sys.stdin:
    print('hello, '+s)

<法二>

while 1:
    try:
        s = input()
    except EOFError:
        pass

EOFError(End of File Error)


參考資料: 高中生程式解題系統 (zerojudge.tw)

0 comments:

張貼留言