For39. The positive integers A and B (A < B) are given. Print all integers from A to B inclusive; Each number must be output as many times as its value (for example, the number 3 is output 3 times).

Solution in Python 3:

import random

A = random.randrange(1,11)
B = random.randrange(A+1,21)

print("A = ",A)
print("B = ",B)
print()

for i in range(A,B+1):
for j in range(0,i):
print(i,end=" ")
print()