forked from kal179/Beginners_Python_Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsortString.py
More file actions
23 lines (22 loc) · 457 Bytes
/
sortString.py
File metadata and controls
23 lines (22 loc) · 457 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# function to sort strings
def sortString():
strr = str(input('Enter : '))
words = strr.split()
words.sort()
print(' ')
for word in words:
print(word)
# main code
print('Hello,')
while True:
startOrEnd = str(input('Start or End : '))
if startOrEnd == 'Start':
print(' ')
print(sortString())
continue
elif startOrEnd == 'End' :
print(' ')
quit() # closes interpreter
else :
print('Oops Try Again')
continue