Python/basics.py

18 lines
446 B
Python
Raw Normal View History

2020-01-29 13:54:51 +00:00
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))