This Python program receives a sample statement and checks whether Sally has taken her bag.
For simplicity, we assume the input is a string describing the situation.
If the string contains the word "taken", the program concludes that Sally has taken her bag.
def did_sally_take_her_bag(statement: str) -> bool:
return "taken" in statement.strip().lower()
# Run the program
sample_input = input("Enter Sally's bag status: ")
if did_sally_take_her_bag(sample_input):
print("Sally has taken her bag.")
else:
print("Sally has not taken her bag.")
Sally has taken her bag.
- The user enters a sentence describing Sally’s bag status
- The program trims whitespace and converts the string to lowercase
- It checks whether the word "taken" is present
- Based on the result, it prints whether Sally has taken her bag or not