Hello All,
I am competely new in Python programming. When i reading Chapter 4 in "How to
Think Like a Computer Scientist: Learning with Python" ,
I am stuck in the exercise 4.
Here is the question:
Enter the following expressions into the Python shell:
1. True or False
2. True and False
3. not(False) and True
4. True or 7
5. False or 7
6. True and 0
7. False or 8
8. "happy" and "sad"
9. "happy" or "sad"
10. "" and "sad"
11. "happy" and ""
Analyze these results. What observations can you make about values of different
types and logical operators? Can you write these observations in the form of
simple rules about and and or expressions?
I have no problem with 1-4, but compelely wrong with the rest. Like question
5, i throught the answer is True, but when i type it in IDLE, I got 7 instead,
question 8 "happy' and 'sad', my answer is True, but the answer is 'happy'. Can
you please tell me why i am wrong. I really appreciate any assistance you can
give.
Thanks
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor