-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (23 loc) · 717 Bytes
/
main.py
File metadata and controls
33 lines (23 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# deleting punctuation from string
questionString = "Hey fellas! I'm new in town here can you help me navigate this area?"
Output = ""
toRemove = '!""()-_{}[];:/?\<>.@#$%^&*~`'
for char in questionString:
if char not in toRemove:
Output = Output + char
print(questionString)
print()
print("below is the same string without the punctuation.")
print(Output)
# program to print a sorted string input
inputStr = "willingly stealing a bike from the mailmen"
splitting = inputStr.split()
toSort = tuple(splitting)
sorting = sorted(toSort)
sortedStr = ""
for word in sorting:
sortedStr += word
sortedStr += " "
print()
print(f"question String: {inputStr}")
print(f"sorted string: {sortedStr}")