![見出し画像](https://assets.st-note.com/production/uploads/images/129297213/rectangle_large_type_2_4cc8bf522116b87ccdfeb3ab9c2d766d.png?width=1200)
Python始めました。桁数を揃えて連番で文字列を生成する ’01’~’20’
for i in range(20):
print(str(i+1).zfill(2),end=' ')
調べたことをメモしておきます。
よく使うと思います
enumerate も使います。
words = ['Python', 'Django', 'Flask', 'Carnival', 'AI']
for i,w in enumerate(words,start=1):
print(w, 'は', i, '番目です')
下記に再投稿していますので良ければ御覧ください。
いいなと思ったら応援しよう!
![こうじ](https://assets.st-note.com/production/uploads/images/14378526/profile_bbfeef96628e63310c8c484ff03c35b7.png?width=600&crop=1:1,smart)