#！/usr/bin/env python3
#--*--coding: utf8--*--
from random import randint, choice
import sys

def chuti():
    cmds = {'+':lambda x, y: x + y, '-':lambda x, y: x - y}
    numbers = [randint(1,50) for i in range(2)]
    numbers.sort(reverse=True)
    op = choice('+-')
    result = cmds[op](*numbers)
    prompt = '%s %s %s = ' % (numbers[0], op, numbers[1])

    for i in range(3):
        try:
            answer = int(input(prompt))
        except ValueError:
            continue
        except (KeyboardInterrupt, EOFError):
            print('\nBye')
            sys.exit()

        if answer == result:
            print('Good')
            break
        else:
            print('Wrong')
    else:
        print('%s%s' % (prompt,result))

def main():
    while True:
        chuti()
        try:
            yn = input('Continue(y/n)? ').strip()[0]
        except IndexError:
            continue
        except (KeyboardInterrupt, EOFError):
            print('\nBye')
            yn = 'n'
        if yn == 'n':
            break

if __name__ == '__main__':
    main()
82105a3b948f8c261798a3daf538cf2884b81414
<mask token>


def main():
    while True:
        chuti()
        try:
            yn = input('Continue(y/n)? ').strip()[0]
        except IndexError:
            continue
        except (KeyboardInterrupt, EOFError):
            print('\nBye')
            yn = 'n'
        if yn == 'n':
            break


<mask token>

<mask token>


def chuti():
    cmds = {'+': lambda x, y: x + y, '-': lambda x, y: x - y}
    numbers = [randint(1, 50) for i in range(2)]
    numbers.sort(reverse=True)
    op = choice('+-')
    result = cmds[op](*numbers)
    prompt = '%s %s %s = ' % (numbers[0], op, numbers[1])
    for i in range(3):
        try:
            answer = int(input(prompt))
        except ValueError:
            continue
        except (KeyboardInterrupt, EOFError):
            print('\nBye')
            sys.exit()
        if answer == result:
            print('Good')
            break
        else:
            print('Wrong')
    else:
        print('%s%s' % (prompt, result))


def main():
    while True:
        chuti()
        try:
            yn = input('Continue(y/n)? ').strip()[0]
        except IndexError:
            continue
        except (KeyboardInterrupt, EOFError):
            print('\nBye')
            yn = 'n'
        if yn == 'n':
            break


<mask token>

<mask token>


def chuti():
    cmds = {'+': lambda x, y: x + y, '-': lambda x, y: x - y}
    numbers = [randint(1, 50) for i in range(2)]
    numbers.sort(reverse=True)
    op = choice('+-')
    result = cmds[op](*numbers)
    prompt = '%s %s %s = ' % (numbers[0], op, numbers[1])
    for i in range(3):
        try:
            answer = int(input(prompt))
        except ValueError:
            continue
        except (KeyboardInterrupt, EOFError):
            print('\nBye')
            sys.exit()
        if answer == result:
            print('Good')
            break
        else:
            print('Wrong')
    else:
        print('%s%s' % (prompt, result))


def main():
    while True:
        chuti()
        try:
            yn = input('Continue(y/n)? ').strip()[0]
        except IndexError:
            continue
        except (KeyboardInterrupt, EOFError):
            print('\nBye')
            yn = 'n'
        if yn == 'n':
            break


if __name__ == '__main__':
    main()

from random import randint, choice
import sys


def chuti():
    cmds = {'+': lambda x, y: x + y, '-': lambda x, y: x - y}
    numbers = [randint(1, 50) for i in range(2)]
    numbers.sort(reverse=True)
    op = choice('+-')
    result = cmds[op](*numbers)
    prompt = '%s %s %s = ' % (numbers[0], op, numbers[1])
    for i in range(3):
        try:
            answer = int(input(prompt))
        except ValueError:
            continue
        except (KeyboardInterrupt, EOFError):
            print('\nBye')
            sys.exit()
        if answer == result:
            print('Good')
            break
        else:
            print('Wrong')
    else:
        print('%s%s' % (prompt, result))


def main():
    while True:
        chuti()
        try:
            yn = input('Continue(y/n)? ').strip()[0]
        except IndexError:
            continue
        except (KeyboardInterrupt, EOFError):
            print('\nBye')
            yn = 'n'
        if yn == 'n':
            break


if __name__ == '__main__':
    main()

#！/usr/bin/env python3
#--*--coding: utf8--*--
from random import randint, choice
import sys

def chuti():
    cmds = {'+':lambda x, y: x + y, '-':lambda x, y: x - y}
    numbers = [randint(1,50) for i in range(2)]
    numbers.sort(reverse=True)
    op = choice('+-')
    result = cmds[op](*numbers)
    prompt = '%s %s %s = ' % (numbers[0], op, numbers[1])

    for i in range(3):
        try:
            answer = int(input(prompt))
        except ValueError:
            continue
        except (KeyboardInterrupt, EOFError):
            print('\nBye')
            sys.exit()

        if answer == result:
            print('Good')
            break
        else:
            print('Wrong')
    else:
        print('%s%s' % (prompt,result))

def main():
    while True:
        chuti()
        try:
            yn = input('Continue(y/n)? ').strip()[0]
        except IndexError:
            continue
        except (KeyboardInterrupt, EOFError):
            print('\nBye')
            yn = 'n'
        if yn == 'n':
            break

if __name__ == '__main__':
    main()