how to make a set of math questions in python

Solutions on MaxInterview for how to make a set of math questions in python by the best coders in the world

showing results for - "how to make a set of math questions in python"
Blanche
20 Oct 2017
1import random
2from datetime import datetime
3import time
4
5random.seed(time.time())
6
7answerlist=[]
8
9for i in range(1,26):
10  sw = False
11  f = random.randint(1,99)
12  w = random.randint(1,99)
13  if f >= 10 and w >= 10:
14    sw = True
15
16  while sw == False:
17    f = random.randint(1,100)
18    w = random.randint(1,100)
19    if f >= 10 and w >= 10 and w <= 99 and f <= 99:
20      sw = True
21    
22  
23  print(str(i)+')',f,'+',w,'=')
24  answerlist.append(f + w)
25
26for i in range(1,26):
27  print(answerlist[i-1])
28
29  
30