Stay N Tom

Showing a slice of what it means to be Thomas.

Pages

Tuesday, August 2, 2011

IDLE (python GUI)

Download the newest version of python. Once you've downloaded python put it in the documents folder in libraries. Download easygui and put it in what ever your python document is (example python 2.7)(The easygui download will be with the Python download at the bottom of the page). Now lets get to the basics. Type "print"Hello world""(NEVER ADD THE FIRST AND LAST ")then press enter(make sure your on IDLE(python GUI)). In blue letters you should see this "Hello world"(you won't see the "). Now type this "7 + 2"(DON'T ADD THE " TO IT). OK now it is time to make a game press file at the top then press new window.
now type in"import random

secret = random.randint(1, 99)
guess = 0
tries = 0

print "AHOY! I'm the Dread Pirate Roberts, and I have a secret!"
print "It is a number from 1 to 99. I'll give you 6 tries. "

while guess != secret and tries < 6:
    guess = input("What's yer guess? ")
    if guess < secret:
        print "Too low, ye scurvy dog! "
    elif guess > secret:
            print "Too high, landlubber! "
    tries = tries + 1
if guess == secret:
    print "Avast! Ye got it! Found my secret, ye did!"
else:
        print "No more guesses! Better luck next time, matey! "
        print "The secret number was", secret
" then press file then press save as. it should open your files. Click on the white name thingy and type "Numgeuess.py" then press save.


This is what it should look like:


4 comments:

  1. Great job Tom! You make me proud.

    ReplyDelete
  2. Cool blog Thomas. I am also 9 and I am looking into programming.

    ReplyDelete
  3. It was originally made for kids but anyone can program it.

    ReplyDelete