#!/usr/bin/env python3 ''' This question generator expects two integer arguments. These are the range for the number of coins in each pocket. ''' import random import sys a = int(sys.argv[1]) b = int(sys.argv[2]) x, y = random.sample(range(a, b), k=2) r = x + y pocket1, pocket2 = random.sample(['left pocket', 'right pocket', 'wallet', 'safe at home'], k=2) currency = random.choice(['Euros', 'US dollars', 'British pounds']) print(f'''--- type: text title: Adding two numbers text: | Suppose you have {x} {currency} in your {pocket1} and {y} in your {pocket2}. How many {currency} do you have? Just answer the number, for example `42`. transform: ['trim'] correct: ['{r}'] solution: | You have a total of {r} {currency}.''')