Python-programming-exercises icon indicating copy to clipboard operation
Python-programming-exercises copied to clipboard

Exercise 1

Open ris46ithi opened this issue 5 years ago • 2 comments

can only join iterable

ris46ithi avatar Sep 25 '20 09:09 ris46ithi

can only join iterable

It means that you can use join operation only on something that can be iterated through such as a list or a tuple.

list1 = ['a','b','c'] print(",".join(list1)) This will result in the output: >>> a,b,c

sumit-jaswal avatar Sep 25 '20 09:09 sumit-jaswal

can only join iterable

Any iterable like a list or a tuple having elements of data type (class) string can be joined to form a new sting. You may either convert those elements to string if needed or do the following print(*list1, sep=',')

Aniruddh-0701 avatar Sep 26 '20 07:09 Aniruddh-0701