Skip to content
Snippets Groups Projects
module5_multiplication_game.py 443 B
Newer Older
  • Learn to ignore specific revisions
  • vand's avatar
    vand committed
    print('Welcome to multiplication game!')
    print('(Empty to quit)')
    import random
    
    s = 'start'
    while not s == '':
        a = random.randint(0, 9)
        b = random.randint(0, 9)
        s = input(f'{a}*{b}=')
        if not s=='':
            try:
                p = int(s)
                if p == a*b:
                    print('Good job!')
                else:
                    print('Oh, no, try again.')
            except:
                print("I don't understand that.")