Improve your skills with Exercise 2: .join() method | HolyPython.com (original) (raw)
Python Join Exercises
Let’s check out some exercises that will help you understand .join() method better.
Exercise 2-a: Join method of strings w/lists
Join the list's elements with: "+++".
“”.join(list) can be used to join elements of a list (or another iterable such as, tuples or dictionaries). Joining character goes inside the brackets and list goes inside the parenthesis.
Exercise 2-b: Join method of strings w/tuples
Join the tuple's elements so that you get a proper email address.
“”.join(list) can be used to join elements of a list (or another iterable such as, tuples or dictionaries). Joining character goes inside the brackets and list goes inside the parenthesis.
email = "@".join(addresses)
Exercise 2-c: Join method with a special character
Join each element in the list with a space character: " "
“”.join(list) can be used to join elements of a list (or another iterable such as, tuples or dictionaries). Joining character goes inside the brackets and list goes inside the parenthesis.
Need More Exercises?
Check out Holy Python AI+ for amazing Python learning tools.
*Includes 14 more programming languages, inspirational tools and 1-on-1 consulting options.
Umut Sagir
Finance & Data Science Professional,
Founder of HolyPython