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?

More than 3 years have passed since last update.

計算ドリルを作りました

Posted at
//qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/569373/3e8c7176-ca7f-b9b3-37d4-866bfe98146b.png)

import random

ichi = random.sample([1,2,3,4,5,6,7,8,9], 9)

ni = random.sample([1,2,3,4,5,6,7,8,9], 9)
#1〜9のリストからランダムに被り無しで9回取り出す
for ICHI in ichi:
    for NI in ni:
        kaitou = int(input(str(ICHI) + '+' + str(NI) + '='))
        #ランダムに出力された計算式をinputで回答を入力できるようにする
        while (kaitou != ICHI + NI):
            print('😷ぜんぜんちがう🦠')
            kaitou = int(input(str(ICHI) + '+' + str(NI) + '='))
          #while文でICHI + NIが成立しない時はループ                         
        if kaitou == ICHI + NI:         print('😇あってるよ😇') ```
                
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?