Basic Coding

Introduction: Basic Coding

This instructable goes over a few basic codes that are often used in coding

Step 1: Variables

A variable is a reference to certain information. You would set these variables like this:

x = apples

Variables is where information can be maintained and referenced.

In this image I made three variables, which were:

Helena = "I like Kpop."

favNum = 8

changeInCar = 6.00

REMEMBER: Use spaces when coding, but not when you are naming something.

Step 2: Print

In coding "print" doesn't mean send information to a printer, but it means show the information.

If you wanted to print out your variables information all you have to do is type "print" (No caps) and then put down the name of the variable beside it.

it should look like this:

print Helena

print favNum

print changeInCar

Step 3: Type of Variables

If you wanted to know the type of variables you are using use "type". In order to see what type of variables you are using, use "print" and place the name of your variable in parentheses.

Once you finish the code and try it out on Python it will tell you:

<type 'str'>

<type 'int'>

<type 'float'>

These are the three types of variables that python uses.

String - a sentence or a sequence of characters.

Integer - A whole number.

Float - A decimal.

Step 4: Input and Raw_input

Input and raw_input are similar, but work differently.

Raw_input will always make a string, but input will allow the user to give input, hence the name.

Be the First to Share


    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge