-3

I have a list containing:

lst = [10,20,30,40]

and i want to print it in a form as such:

output: 10 --> 20 --> 30 --> 40

i tried writing:

print("output: " + "-->".join(lst))

but I'm getting an error saying str format required. Would appreciate some help on this.

Maxxx
  • 3,688
  • 6
  • 28
  • 55

2 Answers2

0

Try something like this:

print(*lst, sep=' --> ')
Mehrdad Pedramfar
  • 10,941
  • 4
  • 38
  • 59
0
lst = [10,20,30,40]

print("-->".join(str(x) for x in lst))

Output:

10-->20-->30-->40