Powered By Blogger

Saturday, July 30, 2011

new game update

I spent 45 or more minutes today at pycamp MAKING! a game!

I created my first while loop that works but now I have to figure out how to get out of the while loop.
my games name is area 51 hack

Friday, July 29, 2011

my first game

today I spent 1:30 hours today at pycamp

I learned about if and else and elif witch is a combination of if and else.

My new game is about hacking into area 51 there are no images only text.

Thursday, July 28, 2011

lists

I spent 1 hour 50 minuits at PyCamp
I learned how to make a list and how to add things to a list and how to see things in a list.

Wednesday, July 27, 2011

local and global scope

I spent 45 minutes at "Py Camp" today.

when I hame a line of code that says:
def sayhello(name)
this is a local scope because this is a function witch can have many operations inside of it and can be called apon to do those things when needed. (name) is the local scope (it's a variable).

a global scope is a variable that is not in a function.

Tuesday, July 26, 2011

logical operators

I spent one hour at Camp.

I learned about logical operators like AND and OR. I also learned about the IF statement and TRUE and FALSE. Here is an example:

(Cats have whiskers.) AND (Dogs have tails) is TRUE.
(Cats have whiskers.) AND (Dogs have wings.) is FALSE.

Monday, July 25, 2011

the journey begins

This was Ben's first day learning Python. He is using 3.1 on OSX 10.6 and working through the book Invent Your Own Computer Games With Python by Al Sweigart. I've asked him to make a note of what he does each day and how long he spent at "Python Camp" that day.

I spent 2 hours.
I learned what the interactive shell is (the code input in python)
and I created my first game (in python that is) by copying from the book: a guess the number game!


# This is a guess the number game.
import random

guessesTaken = 0

print('Hello! What is your name?')
myName = input()

number = random.randint(1, 20)
print('Well, ' + myName + ', I am thinking of a number between 1 and 20.')

while guessesTaken < 6: print('Take a guess.') # There are four spaces in front of print. guess = input() guess = int(guess) guessesTaken = guessesTaken + 1 if guess < number: print('Your guess is too low.') # There are eight spaces in front of print. if guess > number:
print('Your guess is too high.')

if guess == number:
break

if guess == number:
guessesTaken = str(guessesTaken)
print('Good job, ' + myName + '! You guessed my number in ' + guessesTaken + ' guesses!')

if guess != number:
number = str(number)
print('Nope. The number I was thinking of was ' + number)