サンプルプログラム1(NP python編)

# 一行分 読んだものを書く
import sys
print(sys.stdin.readline())
# 一行ずつ 読んでは書く
# (これ以降 import sys は省略する)
for line in sys.stdin:
  print(line)
# 100回リピート
for i in range(100):
  print("hello")
# ファイルを読む
f=open("xxx.txt")
print(f.read)
f.close()

または

# ファイルを読む
with open("xxx.txt") as f:
  print(f.read)
# ファイルに書き込み
with open("yyy.txt",'w') as f:
  f.write('hello')
# sleep と 現在時刻
from time import sleep
from datetime import datetime
for i in range(20):
  print('{}:{}'.format(i,datetime.now()))   # 文字列に値を埋め込む書き方
  sleep(1)