Write a program in Python to use the string join operation to create a string that contains a colon as a separator
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Solution
In Python append() method is used to add an item to the end of the list. It adds a single item to the existing list. On every append function call the length of the list increases by one.
Syntax of append() method
list.append(item)
Here, item is the required parameter, it is of any data type. This method returns the updated existing list.
This is following solution to create a string that contains a colon as a separator.
Output of the above code
elephant:sparrow:eagle:tiger
In the above code, we have taken a blank content list and appends the four elements by using append method. We have used join() method to add a colon as a separator.
need an explanation for this answer? contact us directly to get an explanation for this answer