My MacBook hard drive appears to have bit the dust, and Damon has graciously allowed me to use his old Powerbook until the snow goes away and I can safely trek to the Apple Store for a replacement.
Clearly his Powerbook is infused with Python voodoo, because I had every intention of working on my PHP skillz over the holidays, yet I somehow found my way to the MIT OpenCourseware’s “Intro to Computer Science” course and its corresponding Python tutorials.
So, here is my first working script – The Socratic Methodizer!
print “Welcome to The Socratic Methodizer!\nThink you know the truth? Let’s test that premise!”
premise = raw_input(“Enter your premise: “)
result = raw_input(“Is there ever a time when this is NOT true? “)
result = ”.join (result.split()).lower()
while result == “yes”:
print “Then you better fix it!”
premise = raw_input(“Enter your new premise, taking the exception into account: “)
result = raw_input(“Is there ever a time when this is NOT true? “)
result = ”.join (result.split()).lower()
if result == “no”:
print “You have found truth!”
else:
print “Huh? I don’t speak your language.”
Sample output:
MyMac-4:~/Desktop apple$ python socrates.py
Welcome to The Socratic Methodizer!
Think you know the truth? Let’s test that premise!
Enter your premise: Apples are red.
Is there ever a time when this is NOT true? Yes
Then you better fix it!
Enter your new premise, taking the exception into account: Apples are red and green.
Is there ever a time when this is NOT true? Yes
Then you better fix it!
Enter your new premise, taking the exception into account: Apples are red, green, and yellow.
Is there ever a time when this is NOT true? Yes
Then you better fix it!
Enter your new premise, taking the exception into account: Apples come in many different colors.
Is there ever a time when this is NOT true? No
You have found truth!
Now all I need to do is … figure out how to error-check (my else is a lame cop-out) and then figure out how to make it work outside of the command line (ha!).



{ 2 comments… read them below or add one }
Sounds like a perfect recipe for a single-serving site (http://kottke.org/08/02/single-serving-sites).
i SO could have used this in law school!