Here's a simple python code:
random_list = ["yes", "no", "yessir", "nope", "maybe"]
print(random_list)
This is basics, we created a list and we printed it. The output? Well the expected output is obviously:
['yes', 'no', 'yessir', 'nope', 'maybe']
but if you agree with me, and I am sure you do, the result looks ugly. What if I want the output to look like this? :
yes
no
yessir
nope
maybe
I want to remove the brackets, the speech marks, and I want the list to use line breaks like: \n
You could do this:
print(random_list[0])
print(random_list[1])
print(random_list[2])
print(random_list[3])
print(random_list[4])
But what if the list is extremely long, or you simply do not KNOW how long it is? I am sure you can use len() and 'for' loops to do something, but I can not remember... If you know a way to list the items in this better layout, I will definitely appreciate it. I am not new to python, but I always get mixed up. If you have some advanced methods like using lambda or something, you can share it too. Thanks