Posts

Showing posts from August, 2017

Conditional Execution

Read the first half of of "Think Python" chapter five on Conditionals and Recursion, 5.1-5.5. Write a statement in the interpreter that prints out the last three digits of the number 10245 using the modulus operator. In the interpretor set x=2, y=5 and evaluate the following: x==y, x!=y, x<y, x>y, x<=y, x>=y.  Now in your head set x=5, y=5 and figure out how those six statements would evaluate.  Run them through the interpreter and see if you were right.  Come up with a value for n that would make the following statement True: (n%2==0 and n%3==0). Test this in the interpreter. Would the following statements be True or False for x=3 and y=4, test them after you get your answer to verify:   not x>y x<y or x==y not x==y x<y and x<=y x<y or x<=y Programming Merit Badge requirement 2 :  Give a brief history of programming, including at least three milestones related to the advancement or development of programming. Disc...

Introduction to Python and Programming

I'm not sure on pacing yet, I'll put down what I hope we can get through in a week, but if we don't get to it all we can move some to next week. First off we're going to install a few things that we'll be using.  Go to the Python website and install the latest version of Python (3.6) on our computer.  Follow the instructions to install Pygame as well, we won't be using it right away but later. Read the first chapter of "Think Python" and answer the following questions: What's the difference between a compile and an interpreted programming language? Give three examples of natural languages, two examples of functional languages. What are the three types of errors mentioned in the chapter?  Which do you think can cause the most problems in a program?  Why? Start the Python interpreter (IDLE) and play around a bit.  Use it as a calculator.  Did you get the four basic math functions (add, subtract, multiply, divide)?  How do you do exponents?...