0
0

部分配列 Python3編

Posted at

私が書いたのはこれ

A,B,N = map(int,input().split())
S = list(map(int,input().split()))
for i in range(len(S)):
    if i + 1 >= A and i + 1 <= B:
        print(S[i])

ただ、rangeだと範囲指定ができるのでforループの部分を
下記のようにしてもよい
どっちかと言うと下がいいかも
ただrange関数の癖には注意かも

for i in range(A-1,B):
        print(S[i])

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0