Stay N Tom

Welcome To My Page

Hi I'm Thomas. If you want to be more social go to staynalive.com. My blog is going to help you make websites and games.

Wednesday, May 2, 2012

NXT Mindstorms Lego Class at Legoland

If you go to Legoland, be sure to visit the NXT mindstorms lego class.  Sign up outside the Einstein statue early in the morning before classes fill up (ages 10+).  There are two versions of the class-Mars or the Human Body.  I did the Human Body class.

Each kid was given a robot, a computer, and other lego accessories.  The first thing you had to do was program you NXT robot to use its color sensor so it can navigate the red veins of the human body model.  Next, you program your robot to pick up blue blood cells using a fork lift.  Then you switch the fork lift accessory for a saw accessory.  Next, you program your robot to cut a "bad" blue vein using the saw attachment.  Time for another accessory change to a ball holder.  Your mission is to take 4 medicine balls to the heart and drop them into the right spot.  After successfully programming it to drop balls, you then program it to launch balls.  We ran out of time before I got to launch my ball at the target.

The class lasted about an hour.  I do want to do the class again but I would like to try the Mars missions.

Programming the robot was tricky because you had to measure the distances and put in all the right and left turns.

Other places offer NXT Lego Mindstorm classes including many rec centers.   You can also buy the kit and practice at home.

Tuesday, April 10, 2012

Codecademey!!!

I have been learning javascript recently and this website's first lesson is javascript. Type in the website box : codecademy.com or just click here. Well, after that sign up, click getting started with programing. Follow the steps it takes you through. If for some reason it's blocked or it is not working tell me in the comments.

Tuesday, April 3, 2012

HTML 5

After today's lesson you will be able to do this.













go ahead type your first name, last name and a comment(your the only one that can see it though.)

This is a new unit called HTML 5. It is a combination between HTML and javascript

First we need the program to run HTML 5.click to download the program, Komodo. OPEN IT!!!



Type:

<html>
<head>
 <title> My Form</title>  
    <script>
 
        function loadForm(e) {
            var my_output = document.getElementById("say_hi");
            var first_name_object = document.getElementById("first_name");
            var last_name_object = document.getElementById("last_name");
            var boom = document.getElementById("boom");
            my_output.innerHTML = first_name_object.value + " " + last_name_object.value + "
</br>" + "
</br>" + boom.value;
        }
        function deleteForm(e) {
            var first_name_object = document.getElementById('first_name');
            first_name_object.value = "";
            var last_name_object = document.getElementById('last_name');
            last_name_object.value = "";
            var boom = document.getElementById('boom');
            boom.value = "";
        }
 
</script>
         
         
</head>

<body>

    <form id="toms_form">
<fieldset>
<label for="first_name">First Name: </label><input id="first_name" type="text" />
            <label for="last_name">Last Name: </label><input id="last_name" type="text" />  
         
<div>
<label for="boom">Comments </label><textarea cols="40" id="boom" placeholder="Enter your comments here..." rows="5"></textarea></div>
<div>
<input id="submit_button" onclick="loadForm(); false;" type="button" value="Submit" /></div>
<div>
<input id="reset_button" onclick="deleteForm(); false;" type="button" value="Reset" /></div>
</fieldset>
</form>
<output id="say_hi">
     
    </output>
 
 
</body>
</html>





At the top(make sure your not running any websites but Komodo) click the blue earth, click what you want it to run on(ex. google chrome), and hit run.Try it out. I like it.

Saturday, February 25, 2012

star wars 3D surprise

something space related.
This is also off of my hello world book.

Type this:



import pygame, sys
from math import *
pygame.init()
#wider screen than LunarLander, since we have sideways motion
screen = pygame.display.set_mode([800,600])
screen.fill([0, 0, 0])
ground  = 540   #landing pad is ay y = 540
start = 90      # starting location 90 pixels from top of window
clock = pygame.time.Clock()
ship_mass = 5000.0
fuel = 5000.0
fps = 30  #default
x_loc = 20  # x-location in meters = dist from center of landing pad
y_loc = 40  # y-location in meters = height above the landing pad

x_offset = 40    # offsets so that when ship location is (0,0), ship is
y_offset = -108  #   just touching landing pad, and centered.

x_speed = 2000.0   #pixels/frame
y_speed = -800.0

x_velocity = x_speed/(10.0*fps)  #m/s
y_velocity = y_speed/(10.0*fps)

gravity = 1.5
thrust = 0
delta_v = 0
scale = 10   #scale factor from pixels to meters
throttle_down = False
left_down = False
right_down = False
#held_down = False
count = 0
x_pos = 0
y_pos = 0

"""
x_pos, y_pos in pixels - (0,0) is top left
x_loc, y_loc in meters - (0,0) is center of landing pad

x_speed, y_speed in pixels per frame.
x_velocity, y_velocity in m/s

scale factor = 10  (10 pixels = 1 meter)

pos (pixels) to loc (meters) is scaled by: scaleFactor (meters/pixel)
speed (pixels/frame) to velocity (m/s) is scaled by:
ScaleFactor * FPS (Frames Per Second)

"""


# sprite for the ship
class ShipClass(pygame.sprite.Sprite):
  def __init__(self, image_file, position):
   
      pygame.sprite.Sprite.__init__(self)
      self.imageMaster = pygame.image.load(image_file)
      self.image = self.imageMaster
      self.rect = self.image.get_rect()
      self.position = position
      self.rect.centerx, self.rect.centery = self.position
      self.angle = 0

  def update(self):
      self.rect.centerx, self.rect.centery = self.position
      oldCenter = self.rect.center
      self.image = pygame.transform.rotate(self.imageMaster, self.angle)
      self.rect = self.image.get_rect()
      self.rect.center = oldCenter

Tuesday, February 14, 2012

Valentine surprise

 heres some more games for python.

It's not valentine related but it is old-school.




type this:


import pygame, sys, math, random
from pygame.locals import *
 
pygame.init()
 
# Definerer farger
BLACK = (0,0,0)
WHITE = (255,255,255)
RED = (255,0,0)
GREEN = (0,255,0)
BLUE = (0,0,255)
 
def main():
 
    # Initialisere settings og klokke
    clock = pygame.time.Clock()
    settings = {};
    settings['show_framerate'] = False
    settings['framerate'] = 60
    settings['screen_size'] = settings['width'], settings['height'] = (640, 480)
    settings['currentframerate'] = settings['framerate']
 
    settings['paused'] = False
    settings['players'] = pygame.sprite.Group()
    settings['balls'] = pygame.sprite.Group()
    settings['player1'] = Player('Spiller 1', [50, settings['height'] /2], settings['screen_size'], WHITE)
    settings['player1_score'] = 0
    settings['player1_up'] = K_w
    settings['player1_down'] = K_s
    settings['player2'] = Player('Spiller 2', [settings['width']-50, settings['height'] /2], settings['screen_size'], WHITE)
    settings['player2_score'] = 0
    settings['player2_up'] = K_UP
    settings['player2_down'] = K_DOWN
    settings['score_changed'] = True
    settings['players'].add(settings['player1'], settings['player2'])
    settings['balls'].add(Ball([settings['width']/2, settings['height']/2], settings['screen_size']))
 
    font = pygame.font.Font('arial', 30)
    fpstext = font.render("FPS: "+ str(settings['currentframerate']), 1, WHITE)
    fpstextpos = fpstext.get_rect()
 
    # Initialiserer skjerm
    screen = pygame.display.set_mode(settings['screen_size'], FULLSCREEN, 32)
    pygame.display.set_caption("Ping v0.1")
    random.seed()
    pygame.mouse.set_visible(False)
 
    # Gameloop
    while True:
        start_tick = pygame.time.get_ticks()
        for event in pygame.event.get():
            if event.type == QUIT:
                sys.exit()
            elif event.type == KEYDOWN:
                if event.key == K_ESCAPE:
                    sys.exit()
                elif event.key == K_f:
                    settings['show_framerate'] = not settings['show_framerate']
                elif event.key == K_p:
                    settings['paused'] = not settings['paused']
                elif event.key == K_a:
                    settings['balls'].add(settings['balls'].sprites()[0].maketwin())
                elif event.key == K_1:
                    settings['player1'].modify_size(2)
                elif event.key == K_2:
                    settings['player2'].modify_size(0.5)
                elif event.key == K_3:
                    settings['player1'].modify_speed(10)
                elif event.key == K_4:
                    settings['player2'].modify_speed(1)
                elif event.key == K_5:
                    settings['balls'].sprites()[0].set_speed(2)
                elif event.key == K_6:
                    settings['balls'].sprites()[0].set_speed(10)
                elif event.key == K_q:
                    settings['player1'].modify_speed(5)
                    settings['player2'].modify_speed(5)
                    settings['player1'].modify_size(1)
                    settings['player2'].modify_size(1)
                    settings['balls'].sprites()[0].set_speed(5)
 
        if not settings['paused']:
            # Checking input
            keys = pygame.key.get_pressed()
            if keys[settings['player1_up']]:
                settings['player1'].moveup()
            if keys[settings['player1_down']]:
                settings['player1'].movedown()
            if keys[settings['player2_up']]:
                settings['player2'].moveup()
            if keys[settings['player2_down']]:
                settings['player2'].movedown()
 
            # Moving ball(s)
            settings['balls'].update()
            # Fjerner baller som gaar utenfor skjermen
            for ball in settings['balls'].sprites():
                if ball.rect.left < 0:
                    settings['player2_score'] += 1
                    settings['balls'].remove(ball)
                    settings['score_changed'] = True
                elif ball.rect.right > settings['width']:
                    settings['player1_score'] += 1
                    settings['balls'].remove(ball)
                    settings['score_changed'] = True
            # Legger til en ny ball om det finnes 0 baller paa brettet
            if not bool(settings['balls']):
                settings['balls'].add(Ball([settings['width']/2, settings['height']/2], settings['screen_size']))
 
            # Sjekker kollisjoner
            ball_player_collisions = pygame.sprite.groupcollide(settings['balls'] ,settings['players'], False, False)
            for ball in ball_player_collisions.iterkeys():
                ball.crash(ball_player_collisions[ball])
        else:
            pausetext = font.render("Pause", 1, WHITE)
            pausetext_rect = pausetext.get_rect()
            pausetext_rect = pausetext_rect.move((settings['width'] - pausetext_rect.width) / 2 , (settings['height'] - pausetext_rect.height) / 2)
 
        # Tegner opp skjermbildet
        screen.fill(BLACK)
        if settings['show_framerate']:
            fpstext = font.render("FPS: "+ str(int(clock.get_fps())), 1, WHITE)
            screen.blit(fpstext, fpstextpos)
 
        if settings['paused']:
            screen.blit(pausetext, pausetext_rect)
 
        if settings['score_changed']:
            p1text = font.render("Player 1: "+ str(settings['player1_score']) + " poeng", 1, WHITE)
            p1text_rect = p1text.get_rect()
            p1text_rect = p1text_rect.move(5, settings['height'] - p1text_rect.height - 5)
            p2text = font.render("Player 2: "+ str(settings['player2_score']) + " poeng", 1, WHITE)
            p2text_rect = p2text.get_rect()
            p2text_rect = p2text_rect.move(settings['width'] - p2text_rect.width - 5, settings['height'] - p2text_rect.height - 5)
            settings['score_changed'] = False
 
        screen.blit(p1text, p1text_rect)
        screen.blit(p2text, p2text_rect)
        settings['players'].draw(screen)
        settings['balls'].draw(screen)
        for ball in settings['balls']:
            ball.render(screen)
        pygame.display.update()
 
        # Adjusting framerate
        time = (1000/settings['framerate']) - pygame.time.get_ticks() + start_tick
        clock.tick()
        if time > 0:
            pygame.time.wait(time)
 
class Ball(pygame.sprite.Sprite):
 
    def __init__(self, position, screensize, color = WHITE):
        pygame.sprite.Sprite.__init__(self)
        self.color = color
        self.speed = 5
        if random.random() < 0.5:
            temp = -1.0
        else:
            temp = 1.0
        if random.random() < 0.5:
            temp2 = -1.0
        else:
            temp2 = 1.0
        self.vector = Vector2(temp*random.randint(10,30), temp2*random.randint(10,20))
        self.vector.normalize()
        self.screensize = screensize
 
        self.image = pygame.Surface((10,10))
        self.image.fill(BLACK)
        self.image.set_colorkey(BLACK)
        pygame.draw.circle(self.image, self.color, (5,5), 5)
        self.rect = self.image.get_rect()
        self.rect = self.rect.move(position[0], position[1])
 
    def render(self, screen):
        screen.blit(self.image, self.rect)
 
    def crash(self, players):
        self.vector = Vector2(-self.vector.x, self.vector.y)
        for player in players:
            left = abs(player.rect.left - self.rect.right)
            right = abs(player.rect.right - self.rect.left)
            top = abs(player.rect.top - self.rect.bottom)
            bottom = abs(player.rect.bottom - self.rect.top)
            if left == min(left, right, top, bottom):
                self.vector = Vector2(-abs(self.vector.x), self.vector.y)
            elif right == min(left, right, top, bottom):
                self.vector = Vector2(abs(self.vector.x), self.vector.y)
            elif top == min(left, right, top, bottom):
                self.vector = Vector2(self.vector.x, -abs(self.vector.y))
            elif bottom == min(left, right, top, bottom):
                self.vector = Vector2(self.vector.x, abs(self.vector.y))
 
    def update(self):
        self.rect = self.rect.move(self.vector.x * self.speed, self.vector.y * self.speed)
        if self.rect.top < 0 or self.rect.bottom > self.screensize[1]:
            self.vector = Vector2(self.vector.x, -self.vector.y)
 
    def set_speed(self, new_speed):
        self.speed = new_speed
 
    def maketwin(self):
        twin = Ball([self.rect.left, self.rect.top], self.screensize)
        twin.vector = Vector2(self.vector.x, -self.vector.y)
        twin.speed = self.speed
        return twin
 
class World(object):
 
    def __init__(self, p1, p2):
        self.players = (p1, p2)
 
class Player(pygame.sprite.Sprite):
 
    def __init__(self, name, position, screensize, color = (255,0,0)):
        pygame.sprite.Sprite.__init__(self)
        self.speed = 5
        self.name = name
        self.size = [20,100]
        self.color = color
        self.screensize = screensize
 
        self.image = pygame.Surface((20,100))
        self.image.fill(self.color)
        self.rect = self.image.get_rect()
        self.rect = self.rect.move(position[0]-self.size[0]/2, position[1]-self.size[1]/2)
 
    def render(self, screen):
        screen.blit(self.image, self.rect)
 
    def moveup(self):
        if (self.rect.top > 0):
            self.rect = self.rect.move(0,-self.speed)
 
    def movedown(self):
        if (self.rect.bottom < self.screensize[1]):
            self.rect = self.rect.move(0,self.speed)
 
    def modify_speed(self, speed):
        self.speed = speed
 
    def modify_size(self, size):
        self.rect = Rect(self.rect.left, self.rect.top-((self.size[1]*size-self.rect.height)/2), self.size[0], self.size[1]*size)
        self.image = pygame.transform.scale(self.image, (self.size[0], int(size*self.size[1])))
 
class Vector2(object):
 
    def __init__(self, x, y):
        self.x = x
        self.y = y
 
    def __add__(self, o):
        return Vector2(self.x + o.x, self.y + o.y)
 
    def __sub__(self, o):
        return Vector2(self.x - o.x, self.y - o.y)
 
    def __neg__(self):
        return Vector2(-self.x, -self.y)
 
    def __mul__(self, s):
        return Vector2(self.x * s, self.y * s)
 
    def __div__(self, s):
        return Vector2(self.x / s, self.y / s)
 
    def __str__(self):
        return "Vector2 (%s, %s)"%(self.x, self.y)
 
    def length(self):
        return math.sqrt((self.x**2 + self.y**2))
 
    def normalize(self):
        l = self.length()
        self.x /= l
        self.y /= l
 
    @classmethod
    def from_points(cls, P1, P2):
        return cls(P2[0]-P1[0], P2[1]-P1[1])
 
if __name__ == '__main__': main()

Wednesday, February 1, 2012

game cheats

 I'm going to show you some computer game cheats for kids. Right now I am going to show you poptropica and club penguin. Club penguin only has one that I know of.


Go to the map and there should be an ice island on the far right -->






<---follow the arrow










now the poptropica cheats. Most are pc cheats/all computers except mac, and all computers.

                                 pc cheats:                                                          all computers:

                             control+shift+o              Finish the nabooti island and go to items and click on the phone.
                             control+shift+p                                                        dial 1337
                             control+shift+f5                                                           411
              jump and press control+shift+f6                                                 911
                                                                                                                1225



if you want more ask in comments.

Sunday, December 11, 2011

Christmas time!!!!

Instead of me going on and on about programing I am going to show you how to make a christmas games that are fun.

Here is a yummy Christmas recipe.

Open your python window, open a new window on python and type this:





import pygame

running=True
screen=pygame.display.set_mode([600,700])
pygame.display.set_caption("Gingerbread Decorator")
help=pygame.image.load("resources/buttons/help.png")
screen.fill([255,255,255])
back=pygame.image.load("resources/buttons/back.png")
bread=pygame.image.load("resources/gingerbread.png")
frostin=pygame.image.load("resources/buttons/frost.png")
map=pygame.image.load("resources/map.png")
bites=[pygame.image.load("resources/buttons/bite_1.png"), pygame.image.load("resources/buttons/bite_2.png"),pygame.image.load("resources/buttons/bite_3.png"), pygame.image.load("resources/buttons/bite_4.png"),pygame.image.load("resources/buttons/bite_5.png"), pygame.image.load("resources/buttons/back.png"),]
candies_im={"red":pygame.image.load("resources/red.png"), "green":pygame.image.load("resources/buttons/gumgreen.png")}
buttons=[pygame.image.load("resources/buttons/clear.png"),pygame.image.load("resources/buttons/icing.png"),pygame.image.load("resources/buttons/red.png"),pygame.image.load("resources/buttons/gum.png"),pygame.image.load("resources/buttons/red_line.png"), pygame.image.load("resources/buttons/mouth.png")]

old_pos=[0,0]

clock=pygame.time.Clock()

temp_line=[]
frosting_dots=[]
lines=[]
candies=[]
#candy_struc=["type", [loc_x, loc_y]]
mouse_down=False
adding=""
state="add"

while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running=False
if event.type == pygame.MOUSEBUTTONDOWN:
mouse_down=True
if pygame.mouse.get_pos()[1]<601: if map.get_at(pygame.mouse.get_pos())==(0,0,0, 255): if adding == "red": candies.append(["red", pygame.mouse.get_pos()]) if adding == "green": candies.append(["green", pygame.mouse.get_pos()]) if event.type == pygame.MOUSEBUTTONUP: mouse_down=False if adding=="line": lines.append(temp_line) temp_line=[] if mouse_down: if pygame.mouse.get_pos()[1]<601: if adding=="frost": #print map.get_at(pygame.mouse.get_pos()) if map.get_at(pygame.mouse.get_pos())==(0,0,0, 255): frosting_dots.append(pygame.mouse.get_pos()) if adding=="line": if map.get_at(pygame.mouse.get_pos())==(0,0,0, 255): temp_line.append(pygame.mouse.get_pos()) #if adding=="red": # candies.append(["red", pygame.mouse.get_pos()]) else: if pygame.mouse.get_pos()[0]>50 and pygame.mouse.get_pos()[0]<125 and pygame.mouse.get_pos()[1]>613 and pygame.mouse.get_pos()[1]<688: #clear frosting_dots=[] candies=[] lines=[] if pygame.mouse.get_pos()[0]>140 and pygame.mouse.get_pos()[0]<215 and pygame.mouse.get_pos()[1]>613 and pygame.mouse.get_pos()[1]<688: adding="frost" print "frost" if pygame.mouse.get_pos()[0]>230 and pygame.mouse.get_pos()[0]<305 and pygame.mouse.get_pos()[1]>613 and pygame.mouse.get_pos()[1]<688: adding="red" print "red" if pygame.mouse.get_pos()[0]>320 and pygame.mouse.get_pos()[0]<395 and pygame.mouse.get_pos()[1]>613 and pygame.mouse.get_pos()[1]<688: adding="green" print "green" if pygame.mouse.get_pos()[0]>410 and pygame.mouse.get_pos()[0]<485 and pygame.mouse.get_pos()[1]>613 and pygame.mouse.get_pos()[1]<688: adding="line" if pygame.mouse.get_pos()[0]>500 and pygame.mouse.get_pos()[0]<575 and pygame.mouse.get_pos()[1]>613 and pygame.mouse.get_pos()[1]<688: state="eat" #screen.fill([255,255,0]) screen.blit(back, [0,0]) screen.blit(bread, [0,0]) for dot in frosting_dots: #screen.blit(frosting, [dot[0]-7, dot[1]-7]) pygame.draw.circle(screen, [240,240,240], dot, 8, 0) #try: # pygame.draw.lines(screen, [240,240,240],False, frosting_dots, 10) #except: # pass for candy in candies: screen.blit(candies_im[candy[0]], [candy[1][0]-25, candy[1][1]-25]) for line in lines: try: pygame.draw.lines(screen, [255,0,0], False, line, 5) except: pass try: pygame.draw.lines(screen, [255,0,0], False, temp_line, 5) except: pass for i in range(0,len(buttons)): screen.blit(buttons[i], [i*90+50, 612]) if adding=="": screen.blit(help, [0,0]) if state=="eat": for bite in bites: screen.blit(bite, [0,0]) for i in range(0,len(buttons)): screen.blit(buttons[i], [i*90+50, 612]) if adding=="": screen.blit(help, [0,0]) pygame.display.flip() pygame.time.delay(500) candies=[] lines=[] frosting_dots=[] state="add" pygame.display.flip() clock.tick(60)



name it gingerbread.py


if you have any trouble running it tell me in the comment box. Happy Holidays everyone!!!!

Sunday, October 30, 2011

NEW PROJECT: HTML



Have you ever been on a social site such as facebook or social too?If you have this is how you make social sites!



Watch this!




That is just some HTML. We're not going to do that first.

Alright now to start. HTML means Hypertext Markup Language we just call it HTML for short though. Have your Mom or Dad download(Or if your an adult just download) this thing called nvu.If you have a pc I sugest you should use note pad but this is also ok.

Go ahead and open it. Once you've opened it try typing this (Don't put the parenthesis):
(<)html(>)
(<)head(>)
(<)title(>)just starting
(<)/head(>)
(<)body(>)
(<)p(>)
I can type using html
(<)/p(>)
(<)/body(>)
(<)/html(>)

Note: you always put<(word/letter)>to start it andto end it.





I am using html right now on my blog. You can type anything in the paragraph tag (<)p(>). Another way on writing a paragraph is to use the line break tag (<)br(>). if your paragraph gets to long just close the paragraph (<)/p(>) and put the line break tag and keep on typing. You have to put the end of paragraph tag (<)/p(>) at the end.



How you make pictures and videos is by using the image script (<)img scr=""(>) tag. Go to google images for pictures and youtube for videos. Type (<)img scr=""(>). Now go to youtube or google images. For youtube go to the video you like and go to the description click on share then click on embed. Copy the code (command for a mac or for a pc control(ctrl) c) and in the middle of the quotation marks paste it(command for a mac or for a pc control(ctrl) v). For the pictures on google images choose your image and this time left click(for a mac use two fingers and click) and press copy image URL and paste it between the two quotation marks.


Tuesday, September 20, 2011

Math Operators Are Standing By.......

Let's talk about math in python. There is addition (+), subtraction is a hyphen (-), multiplication (*), now were on to division. Type:

>>> print 6/2

You should see this:

>>> print 6/2
3

now if you type 3/2 it will show:

>>> print 3/2
1

Everyone knows three divided by two is one remainder one! Why is python doing this? Well it's actually trying to be smart. 

To fix this type:

>>> 3.0/2

It should look now like this:

>>>3.0/2
1.5

You can also  do (12 + 2)*1

2 + 7 * 4

(This will give you 30 because of the python language which does 7 * 4 + 2)

Saturday, August 27, 2011

be good like you should

Tom is having a lot going on at his house so I,ll be doing a lot of his blog posts.HoHoHo *<8;-)> *a*n*d* *<[:-) Hey computer elf don't do that! *<8:-(> psssssssssst were hiding at the north pole. Don't say where were hiding!Why am I typing everything I say.

Friday, August 19, 2011

App Programming

I am learning app programming from the following: 
http://www.icodeblog.com/2011/08/17/back-to-basics-hello-iphone/


Just like I learned "Hello World" in Python, I am now learning "Hello World" for the iphone.

Wednesday, August 3, 2011

More than one name to a tag + MORE PROGRAMMING

If 5 + 3 = 8 in python then watch this.
First = 5
Second = 3
print First + Second
8
Now type in this.
YourTeacher = Mrs. Shock
(You have to have one word or this dosen't work)
MyTeacher = YourTeacher
YourTeacher
"Mrs. Shock"
MyTeacher
"Mrs. Shock"
Try this
MyTeacher = "Mrs. Kay"
print MyTeacher
Mrs. Kay
print YourTeacher
Mrs. Shock
Now were going to do is numbers and strings
First = '5'
Second = '3'
First + Second
'53'

Tuesday, August 2, 2011

Hello World book

I'm following the instructions on the Hello World book.

IDLE (python GUI) (Continued)

Press new window then type
print "I love pizza!"
print "pizza " * 20
print "yum " * 40
print "I'm full."
then save it as pizza.py (Always put .py at the END of your python files.).
click run then press run model.
Next were going to give tags names. Type Teacher = "Mr. Morton" then press enter and type in print Teacher and press enter again(You can also do this with numbers). If you do this print "56 + 54" and press enter. 

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: