0
0

python認定基礎試験3章と4章のまとめ

Posted at

●pop()

pop()引数が書かれていない場合は最後の末尾を削除する。

●return

def num(a,b):
    return a+b
result = num(20,30)

print(result)

#出力結果
50

●range
range(0,4)
0,1,2,3
range(1,4)
1,2,3,

●enumerate
反復可能体・・・リスト、文字列など

#iがindexの番号を格納、aに反復可能体の要素を格納
for i,a in enumerate('word'):
    if i == 2:
        print(a)
#出力結果
r

●zip

for n,c in zip([1,2,3,4],['1','4','9','']):
    print(c*n)
#出力結果
1
44
999
ああああ
0
0
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
0