0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Python学習Day38~43で学んだこと

0
Posted at

学んだこと(5/9,5/13~5/15,5/17,5/20)

paizaのランクC問題演習

  • リストのインデックス番号で「[:]」は[開始位置 : 終了位置] の形で使う
    1: → 1番目から最後まで
    :3 → 最初から2番目まで

詰まったところ

文字比較は " " が必要

if z == "F":

文字列は必ずクォーテーションで囲む。

if z == F:

は変数扱いになる。

2次元リストでマス目を表せる

c = [
    [1, 2],
    [3, 4]
]

アクセスは:

c[y][x]

実際に書いたコード

N,X,Y = map(int,input().split())
for i in range(1,N+1):
   if i%X==0 and i%Y==0:
       print("AB")
   elif i %X ==0:
       print("A")
   elif i %Y == 0:
       print("B")
   else:
       print("N")
0
1
0

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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?