Lesson 59

This commit is contained in:
David Avery 2020-01-29 13:54:51 +00:00
parent 197a64869d
commit 64b582fa6f

View File

@ -1,7 +1,18 @@
output = ""
something = ""
while something != "\end":
something = input("Say something: ")
if something != "\end":
output = output + something + ". "
print(output)
def sentence_maker(phrase):
interrogatives = ("how", "what", "why")
capitalized = phrase.capitalize()
if phrase.startswith(interrogatives):
return "{}?".format(capitalized)
else:
return "{}.".format(capitalized)
results = []
while True:
user_input = input("Say something: ")
if user_input == "\end":
break
else:
results.append(sentence_maker(user_input))
print(" ".join(results))