Answers for "how to make a set of math questions in python"

0

how to make a set of math questions in python

import random
from datetime import datetime
import time

random.seed(time.time())

answerlist=[]

for i in range(1,26):
  sw = False
  f = random.randint(1,99)
  w = random.randint(1,99)
  if f >= 10 and w >= 10:
    sw = True

  while sw == False:
    f = random.randint(1,100)
    w = random.randint(1,100)
    if f >= 10 and w >= 10 and w <= 99 and f <= 99:
      sw = True
    
  
  print(str(i)+')',f,'+',w,'=')
  answerlist.append(f + w)

for i in range(1,26):
  print(answerlist[i-1])
Posted by: Guest on November-06-2020

Code answers related to "how to make a set of math questions in python"

Python Answers by Framework

Browse Popular Code Answers by Language