Skip to content

Commit aff9b4a

Browse files
authored
Create JoinList.py
Above is Python code to Split and Join the string based on a delimiter.
1 parent e0373f7 commit aff9b4a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

JoinList.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
3+
def split_string(string):
4+
5+
list_string = string.split(' ')
6+
7+
return list_string
8+
9+
def join_string(list_string):
10+
11+
string = '-'.join(list_string)
12+
13+
return string
14+
15+
if __name__ == '__main__':
16+
string = 'Geeks for Geeks'
17+
18+
list_string = split_string(string)
19+
print(list_string)
20+
new_string = join_string(list_string)
21+
print(new_string)

0 commit comments

Comments
 (0)