Given a verbal question in a deductive reasoning style, is it possible to solve in python?
If the potential variables are never assigned a real world/solid value rather a distance from each other, can it be done? Meaning there is no fixed starting point (i.e. x = 1).
I have tried assigning all variables a 0 to start with and then building from there, but I think this isn't right.
I have an example question here to try, and I have included what I kind of imagine the code to look like. I know its not written in the perfect PEP8 style so please don't criticize that...It is more of a possible example of how I have tried solving the question.
"""Denise arrived at the party 1 hour later than Kylie and 30 minutes before James.
Melissa arrived at the party 30 minutes earlier than Denise and 45 minutes earlier than Sarah.
Is the statement below True?
When James arrived, he found both Melissa and Denise enjoying the party and learned that Sarah
arrived at the party 30 minutes prior to him."""
def deductive_reasoning():
kylie = 0
james = 0
denise = 0
sarah = 0
melissa = [denise - 30, sarah - 45]
denise = [kylie + 60, james - 30]
if (james > melissa[0] and melissa[1]) and (james > denise[0] and denise[1]) and (sarah == james - 30):
print("That is true")
else:
print("That is not true")
deductive_reasoning()