Python 3.1.2 (r312:79360M, Mar 24 2010, 01:33:18) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "copyright", "credits" or "license()" for more information. >>> ================================ RESTART ================================ >>> >>> ================================ RESTART ================================ >>> >>> main() >>> ================================ RESTART ================================ >>> >>> main() >>> ================================ RESTART ================================ >>> >>> main() >>> ================================ RESTART ================================ >>> ================================ RESTART ================================ >>> >>> main() >>> ================================ RESTART ================================ >>> >>> main() >>> ================================ RESTART ================================ >>> >>> main() >>> ================================ RESTART ================================ >>> >>> main2() >>> ================================ RESTART ================================ >>> >>> main() >>> turtle.getshapes() ['arrow', 'blank', 'circle', 'classic', 'square', 'triangle', 'turtle'] >>> ================================ RESTART ================================ >>> >>> ================================ RESTART ================================ >>> >>> regular_polygon(3,100) >>> my_turtle.home() >>> my_turtle.clear() >>> regular_polygon(6,50) >>> my_turtle.speed(0) >>> my_turtle.home() >>> my_turtle.clear() >>> regular_polygon(20,30) >>> my_turtle.home() >>> my_turtle.clear() >>> my_turtle.fd(100) >>> my_turtle.pd() >>> my_turtle.home() >>> my_turtle.clear() >>> my_turtle.fd(100) >>> my_turtle.left(60) >>> my_turtle.fd(100) >>> my_turtle.left(60) >>> my_turtle.fd(100) >>> ================================ RESTART ================================ >>> def print_three_things(thing1, thing2, thing3): print(thing1) print(thing2) print(thing3) >>> print_three_things('thing1','apple','pomegranate') thing1 apple pomegranate >>> def print_three_things_three_times(thing1, thing2, thing3): print_three_things(thing1, thing1, thing1) print_three_things(thing2, thing2, thing2) print_three_things(thing3, thing3, thing3) >>> print_three_things_three_times('thing1','apple','pomegranate') thing1 thing1 thing1 apple apple apple pomegranate pomegranate pomegranate >>> True True >>> False False >>> 'a' == 'a' True >>> 'a' == 'b' False >>> True and True True >>> True and False False >>> 'a' != 'b' True >>> True or False True >>> False or True True >>> True or True True >>> not (False) True >>> not (True) False >>> 'a'=='a' or 'a' == 'b' True >>> 'a'=='a' and 'a' == 'b' False >>> my_variable = 57 >>> 'a' == 'a' True >>> my_variable == 57 True >>> def xor (p, q): return((p or q) and (not (p and q))) >>> True or True True >>> xor(True,True) False >>> True or False True >>> xor(True,False) True >>> xor(True,False) or True True >>> def and_function(p,q): return(p and q) >>> True and True True >>> and_function(True,True) True >>> output = and_function(True,True) >>> output True >>> def is_your_name_bruce (name): if (name == 'Bruce' or name == 'bruce'): print('Your name IS Bruce!') return(True) else: print(“Well, I guess your name isn't Bruce, now is it?”) return(False) SyntaxError: invalid character in identifier >>> def is_your_name_bruce (name): if (name == 'Bruce' or name == 'bruce'): print('Your name IS Bruce!') return(True) else: print("Well, I guess your name isn't Bruce, now is it?”) return(False) SyntaxError: EOL while scanning string literal >>> def is_your_name_bruce (name): if (name == 'Bruce' or name == 'bruce'): print('Your name IS Bruce!') return(True) else: print("Well, I guess your name isn't Bruce, now is it?") return(False) >>> is_your_name_bruce('Bruce') Your name IS Bruce! True >>> is_your_name_bruce('Adam') Well, I guess your name isn't Bruce, now is it? False >>> if True: print('hello') hello >>> if False: print('hello') >>> if (5 == 5): print('hello') hello >>> if (12==5): print('hello') >>> ================================ RESTART ================================ >>> Starving and Exhausted, Goldilocks found a cottage in the middle of the forest. Nobody was home. Should she enter the cottage? Please Answer 'Yes' or 'No':yes She finds some porridge and eats it. Then she breaks some furniture After that, she is very tired. Should she rest for a few minutes in one of the beds? Please Answer 'Yes' or 'No':yes She wakes up surrounded by 3 angry talking bears Should she apologize? Please Answer 'Yes' or 'No':no The sheriff is called. Goldilocks goes to jail for trespassing and destruction of private property >>> def test(): print('hello there! ',end='') out = get_yes_or_no('pickles anyone? ') >>> test() hello there! Traceback (most recent call last): File "", line 1, in test() File "", line 3, in test out = get_yes_or_no('pickles anyone? ') TypeError: get_yes_or_no() takes no arguments (1 given) >>> def test(): print('hello there! ',end='') out = get_yes_or_no() >>> test() hello there! Please Answer 'Yes' or 'No':yes >>> def testing(): if yes_or_no(): print(1) else: if yes_or_no(): print(2) else: print(3) >>> testing() Traceback (most recent call last): File "", line 1, in testing() File "", line 2, in testing if yes_or_no(): NameError: global name 'yes_or_no' is not defined >>> def testing(): if get_yes_or_no(): print(1) else: if get_yes_or_no(): print(2) else: print(3) >>> testing() Please Answer 'Yes' or 'No':yes 1 >>> testing() Please Answer 'Yes' or 'No':no Please Answer 'Yes' or 'No':no 3 >>> def testing2(): if get_yes_or_no(): print(1) elif get_yes_or_no(): print(2) else: print(3) >>> testing2() Please Answer 'Yes' or 'No':yes 1 >>> testing2() Please Answer 'Yes' or 'No':no Please Answer 'Yes' or 'No':no 3 >>> ================================ RESTART ================================ >>> Welcome to the cold or flu program. If you suspect that the patient has either a cold or the flu, this program may be able to figure out which is more likely. Please note that this program was created for demonstration purposes only. It's purpose is to illustrate what an expert system is. No doctor was consulted in the creation of this program. ********************************************* **PLEASE DO NOT USE THIS PROGRAM FOR MAKING** ********ACTUAL MEDICAL DECISIONS.************ ********************************************* The program loosely encodes the content of an article entitled,"Flu or Cold Symptoms?", which appeared at the following URL in the year 2011 http://www.webmd.com/cold-and-flu/cold-guide/flu-cold-symptoms WebMD, LLC is the copyright holder of that article. What is the age of the patient? 18if get_yes_or_no(): print(2) else: print(3) Traceback (most recent call last): File "/Users/adam/Desktop/Summer 2011 Scripts/diagnosis.py", line 146, in main() File "/Users/adam/Desktop/Summer 2011 Scripts/diagnosis.py", line 54, in main age = float(input('What is the age of the patient? ')) KeyboardInterrupt >>> ================================ RESTART ================================ >>> Welcome to the cold or flu program. If you suspect that the patient has either a cold or the flu, this program may be able to figure out which is more likely. Please note that this program was created for demonstration purposes only. It's purpose is to illustrate what an expert system is. No doctor was consulted in the creation of this program. ********************************************* **PLEASE DO NOT USE THIS PROGRAM FOR MAKING** ********ACTUAL MEDICAL DECISIONS.************ ********************************************* The program loosely encodes the content of an article entitled,"Flu or Cold Symptoms?", which appeared at the following URL in the year 2011 http://www.webmd.com/cold-and-flu/cold-guide/flu-cold-symptoms WebMD, LLC is the copyright holder of that article. What is the age of the patient? 18 How many days has the patient been ill? 8 Type "yes" if you have access to a thermometer or are able to find out the patient's temperature Type "no" if you cannot.no How tired is the patient? Type a number from 0 to 10, where 0 = normal level of tired, 5 is very tired, 8 is exhausted, and 10 is so tired that they can't leave the bed.6 Rate the following symptoms on a scale form 0 to 10, where 0 indicates that the patient does not have the symptom at all. 1 indicates the mildest form of the symptom, 5 indicates a high level, and 10 indicates a very extreme form. Rate Patient's Headache or type 0 for no headache3 Rate other aches and pains or type 0 for none4 Type 1 for mild chest discomfort, 2 for a mild cough, 5 for a moderately bad cough, all the way up to 10 for an uncontrollably nasty cough. Type 0 if there is no cough and no chest discomfort2 Indicate the presense (yes) or absense (no) of the following symptoms Does the patient have a runny or stuffy nose? no Is the patient sneezing often?no Does the patient have a sore throat?yes Has the patient been vomiting or experiencing diarrhea?no It is more likely that the patient has the Seasonal Flu, than a cold >>>