String Join in Python
Level 249 keystrokes
This joins the list elements with '-' between them, printing 'Hello-World'. The join() method concatenates strings.
Python code
# Create a list with two string elements1words = ["Hello", "World"]# join() is called on the separator string "-"# It combines list elements with "-" between each# Result: "Hello" + "-" + "World" = "Hello-World"2print("-".join(words))Output
Hello-World
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Python code and how often they appear.
"× 6(× 2)× 2-× 1,× 1.× 1[× 1]× 1=× 1