My+Examples+of+Programming

media type="custom" key="9510784" align="center"

Here is where I will show you how to actually use the information to make something using the Python programming language. ** print ** "Hello World!"
 * print ** "Hello Again"
 * print ** "I like typing this."
 * print ** "This is fun."
 * print ** 'Yay! Printing.'
 * print ** "I'd much rather you 'not'."
 * print ** 'I "said" do not touch this.'

When you type this (above), it will come out the like the words below.


 * Hello World! **
 * Hello Again **
 * I like typing this. **
 * This is fun. **
 * Yay! Printing. **
 * I'd much rather you 'not'. **
 * I "said" do not touch this. **

The reason why it works like that, is because, when you type **print**, it will "print" the text or numbers after it. The pink words are strings. Notice how I put " " around them? That lets the computer know that you want it to type words. If I didn't put those around the words, there would be an error message.


 * color** = { "apple" : "red", "chair" : "brown" ﻿}


 * color**[ "apple" ]

When you type that, this is what it would look like:


 * 'red' **

The reason why it works is because it is a dictionary. When you type **color**[ "apple" ], the computer knows that you want to know the "definition" of "apple". By typing **color** and then "apple" in brackets, it knows that you want to know what the "definition" is, in this case, **red **.

**Animals** = [ "Cat", "Dog" , "BIRD!" ]


 * Animals**

When you input **Animals**, after you type what it equals, you will get an output that looks like this:

**[ 'Cat', 'Dog' , 'BIRD!' ]**

The reason why it works is because it is a list. When you type that **Animals** = [ "Cat", "Dog" , "BIRD!" ] and then you type **Animals**, that tells the computer that you want the **Animals** list. Then the the output would be **[ 'Cat', 'Dog' , 'BIRD!' ] .**

Back To Home