forked from inspirezonetech/TeachMePythonLikeIm5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjoin.py
19 lines (14 loc) · 799 Bytes
/
join.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# ------------------------------------------------------------------------------------
# Tutorial: how to use join() function
# ------------------------------------------------------------------------------------
# join is a built-in-function. It means you don't have to define it before using it
# join is used to connect a list of string
stringList = ["I", "love", "Python"]
# join can have an optional separation string
a = "-separationString-".join(stringList)
# the result can be print as follow
print(a)
# ------------------------------------------------------------------------------------
# Challenge: use join function to join a list of characters.
# the list should be combined to show your name.
# ------------------------------------------------------------------------------------