< Return to Video

Introduction to Programs Data Types and Variables

  • 0:00 - 0:04
    What I want to do in this video is to introduce you
  • 0:04 - 0:07
    to what a computer program is.
  • 0:07 - 0:11
    I highly recommend you follow along
  • 0:11 - 0:13
    because the real way to learn computer science
  • 0:13 - 0:15
    is to really fiddle with things yourself.
  • 0:15 - 0:19
    This is a Python environment. I'm going to be doing a lot
  • 0:19 - 0:22
    of the programming in a language called Python.
  • 0:22 - 0:28
    This environment is called PyScripter. It's free,
  • 0:28 - 0:32
    it's an open-source piece of software and I believe
  • 0:32 - 0:35
    I'm using Python 2.6 or 2.7. As long as you are using
  • 0:35 - 0:39
    Python 2 your examples will be the same as mine,
  • 0:39 - 0:42
    They will work the same way. But If your using Python 3 you are going to have
  • 0:42 - 0:44
    to use slightly different variations every now and then
  • 0:44 - 0:46
    to make it work properly. I'll try to make notes for
  • 0:46 - 0:50
    those when they occur. So lets just start writing ourselves
  • 0:50 - 0:53
    a computer program. What's cool about this is, we can
  • 0:53 - 0:55
    write our computer program right here
  • 0:55 - 0:57
    and really we are just editing text in a file. That's all it is.
  • 0:57 - 1:02
    It's a set of instructions and the computer is just going
  • 1:02 - 1:05
    to start at the top of this file and just go down
  • 1:05 - 1:08
    and read the instructions., although you will see
  • 1:08 - 1:10
    later on that there are ways to tell the computer to jump
  • 1:10 - 1:13
    around and loop around within the instructions, so that
  • 1:13 - 1:15
    it can do things over and over again or skip parts of the program.
  • 1:15 - 1:18
    With that said lets write ourselves a simple program
  • 1:18 - 1:21
    and while we do this we will expose ourselves to some of the
  • 1:21 - 1:24
    core concepts that exist within a computer program.
  • 1:24 - 1:27
    So let me just write a very very simple computer program.
  • 1:27 - 1:32
    So one very simple computer program
  • 1:32 - 1:34
    would literally just be an expression.
  • 1:34 - 1:42
    So let me just write 'print 3+7', so it's literally
  • 1:42 - 1:45
    just going to take 3+7 and print it. It's going to pass
  • 1:45 - 1:48
    it to the print function which comes with Python
  • 1:48 - 1:52
    and maybe I will write like this: print(3+7)
  • 1:52 - 1:55
    Lets save this file. So there's literally only on command
  • Not Synced
    here on the top line that says print 3+7.
  • Not Synced
    Actually, let's add another command,
  • Not Synced
    just so you can see that it's going to go top down.
  • Not Synced
    let me add another one: print(2-1)
  • Not Synced
    and lets do: print("this is a chunk of text")
  • Not Synced
    Now let's see what this computer program is going to do.
  • Not Synced
    Let me save it. I saved it as the file "testarea.py".
  • Not Synced
    The .py extension signifies it is a Python file.
  • Not Synced
    Now let me run the program. What's nice about these
  • Not Synced
    IDE or Integrated Development Environments is that
  • Not Synced
    you can type and run the program in the same place.
  • Not Synced
    It also color-codes your text, so you can see what's a
  • Not Synced
    function, what's not a function, the different data-types...
  • Not Synced
    Let's run the program to see what happens.
  • Not Synced
    So there we go, we ran it!
Title:
Introduction to Programs Data Types and Variables
Description:

Writing a basic program. Basics of data types, variables and conditional statements

more » « less
Video Language:
English
Duration:
11:28

English subtitles

Revisions Compare revisions