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:
This is what it should look like:
Great job Tom! You make me proud.
ReplyDeleteThaks Dad.
ReplyDeleteCool blog Thomas. I am also 9 and I am looking into programming.
ReplyDeleteIt was originally made for kids but anyone can program it.
ReplyDelete