How to print all of the elements in a list

By : Zizma
Source: Stackoverflow.com
Question!

I need to be able to print all of the elements in a randomly chosen list without the brackets or commas. I tried to print each element with the '+' operator but it raised an error about not being able to convert the list to a string. Here is my code now:

t1 = ["rock", 80, 1,2,1]
t2 = ["carpet", 75, 2, 2, 1]
t3 = ["lava", 1000, 1, 1, 1]
t4 = ["rock", 90, 2, 1, 1]
Tiles = [t1, t2, t3, t4]
print(random.choice(Tiles)[0] + [1] + [2] + [3] + [4])
By : Zizma


Answers
print(repr(random.choice(Tiles))[1:-1].replace(',','  '))
By : eyquem


You should save the result of random choice in a variable, then iterate over its members and print in order.

By : Patrick87


By : sampwing


This video can help you solving your question :)
By: admin