forked from RoksYz/CS1301xIII---Data-Structures
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStrInput.py
More file actions
21 lines (19 loc) · 717 Bytes
/
StrInput.py
File metadata and controls
21 lines (19 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def string_type(s):
if s == "":
return "empty"
elif s == s[0]:
return "character"
elif len(s.split()) < 2:
return "word"
elif "\n" in s:
return "page"
elif " " and ". " in s:
return "paragraph"
else:
return "sentence"
print(string_type(""))
print(string_type("!"))
print(string_type("CS1301."))
print(string_type("This is too many cases!"))
print(string_type("There's way too many ostriches. Why are there so many ostriches. The brochure said there'd only be a few ostriches."))
print(string_type("Paragraphs need to have multiple sentences. It's true.\nHowever, two is enough. Yes, two sentences can make a paragraph."))