Lines 43 til the end say: #If your function works correctly, this will originall
ID: 3707933 • Letter: L
Question
Lines 43 til the end say:
#If your function works correctly, this will originally
#print:
#empty
#character
#word
#sentence
#paragraph
#page
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. However, two is enough. Yes, two sentences can make a paragraph."))
Explanation / Answer
def string_type(s): if len(s) == 0: return "empty" elif len(s) == 1: return "character" elif s.count(' ') == 0: return "word" elif s.count('.') 1: if s.count(' ') > 0: return "page" else: return "paragraph" 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. However, two is enough. Yes, two sentences can make a paragraph."))Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.