Home

Welcome Coding Buddies!

Learn the basics of computer programming

Let's Begin!

Most Recent Lesson


Printing, Variables and Input

Welcome to your first lesson!
In this lesson you will be learning the basics of input and output. You can think of programming as writing the instuctions that tells the computer what to do.

The print function is primarily used for outputting text onto the screen. Typing print "sample text" will display the text written in the quotations onto the screen.

You can also print the value of variables by typing print variableName. Variables are like containers where each unique variable name (i.e. "age") can hold a specific variable type, which can range from numbers, words, characters and so on. Variables can be assigned values by using an equal sign ("="). They can be changed by assigning them with new values or adding onto the existing value.

In most programs, part of the program is the ability to have input from the user. Input is when the computer wants the user to enter information. It is important to remember that the information that the user enters need to be stored somewhere and we can do that by putting it in a variable. The two main types of input in Python (Version 2) are raw_input() and input().
  • raw_input("Optional text") - can take in any type of input, from sentences to numbers
  • input("Optional text") - can take in only numbers, and unlike raw_inputs, can perform math equations with them

More Details

The main variables that are often used are strings, integers, doubles, characters, boolean.

  • Strings - contain letters, words or even sentences.
  • Integers - contain any whole number (including negative numbers)
  • Doubles - contain decimal numbers
  • Characters - contain any single character or symbol
  • Boolean - are either true or false

Try It Out!

Go to Replit
  • Ask for the user's name, then print it.
  • Ask for a color and a number, print the number and then print the color.

Related Problems