Monday, January 31, 2011

Jan 31

OK the resources ill use for my goal will be the python book provided by the class and then ill also use the How to Think Like a Computer Scientist site. My plans are by the first week or by the second week ill be caught up on my questions with my chapters and will be well onto ether chapter 7 or chapter 8. By the third week I am planning on trying to build some sort of animation or action produced through python script. Examples are maybe making a program that allows you to press any button and then after pressing the button a animation will appear on the screen or something along those lines.
Continue onto Chapter 4 questions:
  1. >>> 5 % 2
 1
  1. >>> 9 % 5
4
  1. >>> 15 % 12
3
  1. >>> 12 % 15
12
  1. >>> 6 % 6
0
  1. >>> 0 % 7
0
  1. >>> 7 % 0
integer division or modulo by zero is the end result I get when i try to put 7%0 into python. Python does this because it cant get 7% of 0 when 0 has nothing in it.
#2: make a program
p      q     not p or q
=====================
True    True    True
True    False   True
False   True    True
False   False   False
 
p      q      p and q
======================
True    True    True 
True    False   False
False   True    False
False   False   False

p      q      not p and q
==========================
True    True    False
True    False   False
False   True    True 
False   False   False

 p      q      not(p) or not(q)
============================
True    True    True 
True    False   False
False   True    True 
False   False   True 

 p      q      not(p) and not(q)
============================
True    True    True 
True    False   False
False   True    True 
False   False   True 
After a few minutes I figured what they meant by changing "p or q" to stuff like "not p and not q".
#4:

1 comment:

  1. Excellent! These logical expressions are central to computer program, since computers are essentially "logic calculators".

    Your last comment is particular encouraging, since it means you really "get it". You critically evaluated what you saw and created your own "test" to make sure your understanding matched the behavior of the system.

    ReplyDelete