Jared Rendell Jared Rendell - 5 months ago 17
Python Question

How to print out a string of a '&', equal to the length of a list

Hi so I want to print out a list of the character '&' as many times as there are in a given number. So if the number is 10, I want the result to be '&&&&&&&&&&&'

What I have done is iv turned the int into a list so I can better visualize what Im wanting to do.

def print_list_&(size):
"""super serious docstring"""
result_1 = 1
result_2 = size + 1
result = list(range(result_1, result_2))
return result

But I'm kind of stuck on where I go from here.
This is Uni work so I'm better off with a push in the right direction than a straight answer. To be fussy

Any help would be great though, thanks.

Answer Source

'&' * 10 will give you '&&&&&&&&&&'. Therefore it seems you just need '&' * size.