numbers = [5, 2, 5, 2, 2]
for item in numbers:
print("...")
This just prints the string for each item in the list, but I don't know how to make it print said string by the number of times as the item in the list.
numbers = [5, 2, 5, 2, 2]
for item in numbers:
print("...")
This just prints the string for each item in the list, but I don't know how to make it print said string by the number of times as the item in the list.
In python you are allowed to use multiplication (*
) between an integer and a string which should do what you want.
numbers = [5, 2, 5, 2, 2]
for item in numbers:
print(item * "...")
Result is
...............
......
...............
......
......