GITLAB

Miguel Barão / aprendizations

Sign in
  • Sign in
  • Project
  • Files
  • Commits
  • Network
  • Graphs
  • Issues 0
  • Merge Requests 0
  • Wiki
  • aprendizations
  • demo
  • math
  • addition
  • addition-two-digits.py
  • f4809e6f   - code cleaning questions.py ... Browse Code »
    - fix image size in solution box
    - update demo to match the new courses organization
    Miguel Barão
    2019-11-03 21:46:45 +0000  
addition-two-digits.py 325 Bytes
Edit Raw Blame History
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/usr/bin/env python3

import random
import sys

a = int(sys.argv[1])
b = int(sys.argv[2])

x = random.randint(a, b)
y = random.randint(a, b)
r = x + y

print(f'''---
type: text
title: Adição de números com 2 algarismos
text: |
  Qual o resultado da soma ${x}+{y}$?
correct: ['{r}']
solution: |
  O resultado é {r}.''')