As the title stated any list comprehension or enumerate way to do this. Note, this not assignment, juts me trying to improve my coding skills. Thanks
arr_1 = [
['boot', 3],
['camp', 2],
['program', 0]
]
ls = []
for sublist in arr_1:
str_to_rept = sublist[0]
num_of_time = sublist[1]
for i in range(num_of_time):
ls.append(str_to_rept)
print(ls)
Output:
['boot', 'boot', 'boot', 'camp', 'camp']