Worksheet Creation

Viewed 25

I am trying to make a math worksheet for grade schoolers. I wanted to make it as a np.random.randint function to generate some 2-digit, 3-digit and 4-digit numbers then process the numbers to form a worksheet in the manner that a grade schooler is used to. I having trouble joining the number generated to look like this 1 With my current code I got to this

q1=q2=[]
q1= [two_digit[0],two_digit[1]]
q2=[two_digit[2],two_digit[3]]
addition="+".join(map(str,q2))
print(addition)

this gives an output like this

55+50

is there a better way to manipulate int to become string then go into a format that can be printed out easily?

1 Answers

You can use new lines and the unicode upperscore.

questions = [q1, q2]
nr_of_digits = 2

for q in questions:
    q = list(map(str,q))
    print(" " + q[0] + "\n" + "+" + q[1] + "\n" + u'\u0305' * (nr_of_digits + 1) + "\n")
Related