00:01 - 00:06

hey guys so welcome back um today I'm

00:04 - 00:09

going to be doing a Python tutorial

00:06 - 00:11

Series so this is the first episode in

00:09 - 00:13

the series it's kind of an introduction

00:11 - 00:15

showing you how to download python how

00:13 - 00:18

to install it and then going into data

00:15 - 00:20

types and variables so the first

00:18 - 00:22

important thing to understand about the

00:20 - 00:24

Python programming language so don't

00:22 - 00:27

worry if you've never programmed before

00:24 - 00:29

um I'm going to be going over everything

00:27 - 00:31

very slowly and in depth so that you can

00:29 - 00:32

understand I recommend that you follow

00:31 - 00:34

along with everything I'm doing in the

00:32 - 00:37

tutorial uh pause the video at certain

00:34 - 00:38

points rewind if you don't understand um

00:37 - 00:40

it's important you understand these

00:38 - 00:41

parts so that we can move forward into

00:40 - 00:44

more complex

00:41 - 00:45

ideas so obviously the first um thing

00:44 - 00:47

that we're going to have to do if we're

00:45 - 00:50

going to Learn Python is we have to

00:47 - 00:51

install it on our computer so uh we're

00:50 - 00:55

just going to go to the python website

00:51 - 00:57

up here python.org downloads right here

00:55 - 01:00

and all you're going to do is just click

00:57 - 01:02

download python 3.6.1

01:00 - 01:04

now I'm not going to do that because I

01:02 - 01:06

already have python installed and

01:04 - 01:08

downloaded on my computer but pretty

01:06 - 01:09

much once you uh download this it's

01:08 - 01:11

going to pop up down here in your

01:09 - 01:13

downloads folder just run the exe it's

01:11 - 01:15

very simple um and you'll be running

01:13 - 01:17

python in no time so now pause the video

01:15 - 01:19

go ahead and do that and then we can go

01:17 - 01:21

to the next

01:19 - 01:23

steps okay so once you've done that

01:21 - 01:25

you're going to notice that you have an

01:23 - 01:28

application that looks like this it's

01:25 - 01:30

called idle um Python and then it'll

01:28 - 01:33

have the version so I'm using version 3

01:30 - 01:35

3.5 um don't worry if you have a version

01:33 - 01:37

that is larger than that so 3.6 or even

01:35 - 01:39

one that's before that most of the

01:37 - 01:40

things that I do in this will work in

01:39 - 01:44

all the versions of

01:40 - 01:45

python okay so go ahead and run the idle

01:44 - 01:48

you'll notice the first thing that pops

01:45 - 01:51

up is the python shell as you can see at

01:48 - 01:53

the top here the shell now this right

01:51 - 01:56

here is not where we're going to write

01:53 - 01:59

all our programs it's the console kind

01:56 - 02:03

of so here I can type any lines of code

01:59 - 02:06

for example I want to print a name like

02:03 - 02:07

this and it'll run right away so that's

02:06 - 02:09

not what we're going to do you can play

02:07 - 02:10

around with this if you want but we're

02:09 - 02:13

going to go to file and we're going to

02:10 - 02:16

click new

02:13 - 02:18

file and then here we go so now we have

02:16 - 02:18

a new document that we're going to be

02:18 - 02:20

working on and we're going to be

02:18 - 02:23

programming in so I'm going to go ahead

02:20 - 02:27

and I'm going to save this right away as

02:23 - 02:30

tutorial one into my tutorial folder

02:27 - 02:33

which I believe is on my desktop

02:30 - 02:35

right here yep right there awesome okay

02:33 - 02:37

so there we go we've saved it and now

02:35 - 02:39

we're ready to learn a little bit about

02:37 - 02:41

data types so pretty much python is a

02:39 - 02:43

fair Fairly basic language in comparison

02:41 - 02:46

to a lot of other ones a lot of things

02:43 - 02:48

that it does is uh more simple than

02:46 - 02:49

other languages but it is important to

02:48 - 02:52

understand the basic data type so

02:49 - 02:53

there's four main data types in Python

02:52 - 02:55

there is a few more but we're just going

02:53 - 02:58

to talk about these ones right now um

02:55 - 03:01

the first one is an integer so that can

02:58 - 03:04

be uh a short form int that stands for

03:01 - 03:10

integer now um an integer is any number

03:04 - 03:12

so such as 1 4 76 any whole number it's

03:10 - 03:13

important that is a whole number it

03:12 - 03:17

could be a negative number as

03:13 - 03:20

well5 um zero those are all

03:17 - 03:23

integers okay now we have strings now

03:20 - 03:25

the short form for Strings is St now

03:23 - 03:28

pretty much a string is anything

03:25 - 03:30

embedded in quotations so like this uh

03:28 - 03:33

this is my name Tim that is a string and

03:30 - 03:38

then we also have something like this

03:33 - 03:40

this will be a string and even like this

03:38 - 03:42

this would be a string so although there

03:40 - 03:47

is a number in here since it is between

03:42 - 03:49

these two quotations here it is a string

03:47 - 03:52

so even if I did another number like

03:49 - 03:54

like that string um now it's also

03:52 - 03:56

important to understand that it doesn't

03:54 - 03:58

matter if you use the single quotations

03:56 - 04:01

or the double quotations sometimes we

03:58 - 04:03

use the single quotations because inside

04:01 - 04:06

of our actual quotations we want to use

04:03 - 04:08

double quotations or maybe um if we use

04:06 - 04:10

the double quotations because we want to

04:08 - 04:13

use the single quotations inside of our

04:10 - 04:16

actual string like that okay so those

04:13 - 04:20

are just a few examples um now we have

04:16 - 04:24

Boolean variables uh or data types sorry

04:20 - 04:28

so Boolean data types is something like

04:24 - 04:31

true and false so true and false pretty

04:28 - 04:33

basic um these are reserved words in

04:31 - 04:35

Python um meaning that they're

04:33 - 04:37

highlighted in yellow and that you

04:35 - 04:39

cannot use them for variable names

04:37 - 04:41

that's going to be important later on um

04:39 - 04:44

just know that they are important words

04:41 - 04:46

uh true and false and they do start with

04:44 - 04:49

capitals so um for example if I type

04:46 - 04:52

true like this uh it's not highlighting

04:49 - 04:54

Orange right so that's because true um

04:52 - 04:57

in Python the keyword for that starts

04:54 - 05:00

with a capital so true and false um then

04:57 - 05:03

we have the um decimals which are the

05:00 - 05:06

float uh data type like this so anything

05:03 - 05:09

with a decimal floating point so

05:06 - 05:11

1.23 um anything like that any decimal

05:09 - 05:13

number with a floating decimal point uh

05:11 - 05:17

would be a

05:13 - 05:20

float okay so those are the four basic

05:17 - 05:22

um data types um there is a few more

05:20 - 05:25

that I'll go on to later on but you just

05:22 - 05:27

have to understand these ones right now

05:25 - 05:29

so now that we know these data types

05:27 - 05:31

I'll give a quick little quiz here so

05:29 - 05:35

I'm just going to put a

05:31 - 05:35

few things right

05:37 - 05:41

here and then I want you to pause the

05:39 - 05:46

video and go ahead and try to determine

05:41 - 05:49

what type of data type these things

05:46 - 05:51

are okay so go ahead pause the video and

05:49 - 05:53

then I'll go over the answers in a

05:51 - 05:56

second okay so we'll start with the

05:53 - 05:57

first one here uh hello it's the same

05:56 - 05:59

example that I have up here except in

05:57 - 06:03

single quotations so we can see that it

05:59 - 06:05

is a string data type okay so that is

06:03 - 06:06

the short form Str Str now we have the

06:05 - 06:10

number

06:06 - 06:11

123 that would be the integer data type

06:10 - 06:13

we have another number here that has a

06:11 - 06:15

decimal point so

06:13 - 06:19

3.22 that would be a

06:15 - 06:22

float we have the keyword true this data

06:19 - 06:25

type is a Boolean data type then we have

06:22 - 06:26

two in quotations this is very important

06:25 - 06:29

we don't want to get this mixed up this

06:26 - 06:31

is a string some people may think that

06:29 - 06:33

it's an integer because it's two but no

06:31 - 06:35

it actually is a string because it is

06:33 - 06:37

inside of the quotations and then same

06:35 - 06:39

thing here three inside of the double

06:37 - 06:42

quotations again is a string not an

06:39 - 06:45

integer okay so now that we have an idea

06:42 - 06:48

of the basic data types um I'm going to

06:45 - 06:49

show you how to create a variable so

06:48 - 06:51

pretty much you may have heard of

06:49 - 06:54

variables before in math or something

06:51 - 06:57

like that um in math we tend to use X as

06:54 - 07:00

a variable we say x may be five x may be

06:57 - 07:02

four anything like that um it's the same

07:00 - 07:05

thing in Python now declaring a variable

07:02 - 07:06

in Python is very easy all you have to

07:05 - 07:09

do is type the variable name so in this

07:06 - 07:12

case I'm going to use name and then

07:09 - 07:13

simply give it a value so this value as

07:12 - 07:15

you may remember is a string this is my

07:13 - 07:17

name and I'm just storing it in the

07:15 - 07:19

variable

07:17 - 07:21

name now if I want to access that

07:19 - 07:24

variable I want to see what that

07:21 - 07:27

variable is I can print it to the

07:24 - 07:29

console by simply typing the variable

07:27 - 07:32

name which is name so now we'll see what

07:29 - 07:33

happen happens um if I run the program

07:32 - 07:36

just going run run module I'm going to

07:33 - 07:38

use F5 from now on so that's the uh

07:36 - 07:42

thing and you can see it prints out Tim

07:38 - 07:44

just like that okay now um say we did

07:42 - 07:46

that we have name equals Tim we printed

07:44 - 07:49

it to the screen now maybe we want to

07:46 - 07:51

change that variable well it's very easy

07:49 - 07:52

again all we have to do is just type the

07:51 - 07:55

value name and now maybe we're going to

07:52 - 07:57

change it to Bob and now we want to see

07:55 - 08:00

what the new V new variable is so we

07:57 - 08:03

will print it to the screen we'll print

08:00 - 08:06

name click F5 to run that and we'll see

08:03 - 08:09

name and or sorry Tim and then Bob so

08:06 - 08:12

like we have here name equals Tim print

08:09 - 08:14

name name equals Bob print name right so

08:12 - 08:17

we've set it like that okay so that's

08:14 - 08:19

pretty basic um now you can create

08:17 - 08:22

variables of different data types so for

08:19 - 08:25

example if we had a variable age I would

08:22 - 08:27

use an integer data type so like 18 for

08:25 - 08:29

that variable and then again if I wanted

08:27 - 08:32

to print into the screen I would type

08:29 - 08:35

print and then the variable name like

08:32 - 08:39

that okay 18 perfect right so we printed

08:35 - 08:41

that to the screen um again if the

08:39 - 08:44

variable names um there's a few

08:41 - 08:46

restrictions on variable names so here

08:44 - 08:49

you just see I've used three lowercase

08:46 - 08:51

letters um your variable names can

08:49 - 08:54

contain underscores um they cannot

08:51 - 08:57

contain dashes um they can only contain

08:54 - 08:59

underscores text and they cannot start

08:57 - 09:00

with a number I believe so if I try to

08:59 - 09:04

do

09:00 - 09:07

one one name equals 2 for

09:04 - 09:09

example I run into an invalid syntax

09:07 - 09:11

error because we can't name a variable

09:09 - 09:13

starting with a number now I can end it

09:11 - 09:16

with a number I

09:13 - 09:16

believe let us

09:17 - 09:22

try yep so that's fine it's let us do

09:19 - 09:26

that name equals one I could do name

09:22 - 09:27

underscore um person maybe yeah name

09:26 - 09:31

undor person you see if I run that

09:27 - 09:34

program everything's fine there um but I

09:31 - 09:36

can't put something like a star in my

09:34 - 09:38

variable

09:36 - 09:41

name you see how we've got an invalid

09:38 - 09:43

syntax there right this is because these

09:41 - 09:46

symbols represent something else in the

09:43 - 09:48

Python language so just know for names

09:46 - 09:50

um we can use capitals if we'd like I

09:48 - 09:54

could use name like

09:50 - 09:55

that run the program that works fine but

09:54 - 09:57

I cannot start it with numbers so I

09:55 - 09:59

cannot put a number there um and I

09:57 - 10:02

cannot contain anything other than under

09:59 - 10:06

scores texts and numbers in or at the

10:02 - 10:08

end of the variable name now here's a

10:06 - 10:12

quiz for you if I make a variable called

10:08 - 10:15

name and I do another variable called

10:12 - 10:18

name um are they the same thing now

10:15 - 10:20

that's a good question um are these two

10:18 - 10:23

the same thing um no they are not the

10:20 - 10:26

same thing so capitals do matter in

10:23 - 10:29

Python the all capitals variable name is

10:26 - 10:31

different than the variable name so

10:29 - 10:35

again name like this is different than

10:31 - 10:37

all of those variables there okay so I

10:35 - 10:39

think I've covered um a little bit on

10:37 - 10:42

variables and data types today um this

10:39 - 10:45

is the complete Basics just wanting to

10:42 - 10:46

get everyone caught up um in the next

10:45 - 10:50

video we'll go into some more advanced

10:46 - 10:51

things maybe uh operations of variables

10:50 - 10:54

adding them together subtracting

10:51 - 10:56

multiplying um booing conditions things

10:54 - 10:59

like that okay so I hope you enjoyed the

10:56 - 11:01

video today um stay tuned and we're

10:59 - 11:03

going to have another one out tomorrow

11:01 - 11:08

um and like the video if you if it was

11:03 - 11:08

good and subscribe so yeah thank you

Learn Python: A Comprehensive Introduction to Data Types and Variables

In this first episode of the Python tutorial series, we dive into the fundamentals of Python programming by focusing on how to install Python and an overview of essential data types and variables. Whether you're a complete novice or just need a quick refresher, this guide simplifies your journey into the world of Python programming. With a clear explanation of concepts like integers, strings, booleans, and floats, readers will be set for success as they move into more complex programming ideas.

Getting Started: Installing Python

To embark on your Python programming adventure, the first step is to install it on your computer. Visit the official python.org website and navigate to the downloads section. Click on "Download Python 3.6.1" or the latest version available. Once downloaded, run the executable file, and you'll have Python installed in no time. If you encounter any issues, don’t hesitate to pause the video or rewind until you've completed the installation.

Exploring Python IDLE: The Console Interface

After successful installation, you'll find an application called IDLE on your computer. Open it, and the Python Shell will appear. It's important to note that while the Shell allows you to type and execute code directly, you will eventually want to create a new file for your programs. Click on "File" and select "New File" to begin working on your projects. Save your new document with an appropriate name in a designated folder.

Understanding Python's Basic Data Types

Before jumping into coding, let's get familiar with the four primary data types in Python:

  1. Integers (int): Whole numbers, including both positive and negative values (e.g., -5, 0, 76).

  2. Strings (str): Sequences of characters enclosed in either single or double quotes (e.g., "Hello", '123').

  3. Booleans (bool): This data type has only two values, True and False, and is crucial for conditional statements.

  4. Floats (float): These are decimal numbers that contain a floating-point (e.g., 1.23, -4.56).

As you write code, knowing these data types will help you store and manipulate information effectively.

Quiz Time: Identifying Data Types

To reinforce your understanding, here's a quick quiz. Pause the video to determine the data types of the following examples:

  • "Hello"
  • 123
  • 3.22
  • True
  • "2"
  • "3"

Once you're ready, let's uncover the answers together:

  • "Hello" is a string (str).
  • 123 is an integer (int).
  • 3.22 is a float.
  • True is a boolean (bool).
  • "2" is a string (str) because it’s enclosed in quotes, not an integer.
  • "3" is also a string (str) for the same reason.

Creating and Using Variables

Now that you're familiar with basic data types, it’s time to learn about variables. In programming, a variable is a named storage location that can hold different values. To create a variable in Python, follow this syntax:

variable_name = value

For example:

name = "Tim"

You can use the print() function to display the value stored in your variable:

print(name)

If you ever need to change the value of a variable, simply assign a new value to it:

name = "Bob"
print(name)

Variable Naming Conventions

Understanding how to name your variables properly is crucial:

  • Variable names can include letters, numbers, and underscores, but cannot start with a number.
  • Avoid using special characters (e.g., $, %, &, etc.) in variable names.
  • Variable names are case-sensitive, meaning Name and name would refer to two different variables.

Test your understanding of variable names by trying to create these examples:

1name = "Invalid"  # This will raise an error!
valid_name = "Valid"
name_1 = "Valid too"

Conclusion: Moving Forward

Today, we've laid the groundwork for understanding Python programming by installing Python, exploring its interface, and learning about data types and how to create variables. As we wrap up this introductory tutorial, remember to practice what you’ve learned and stay tuned for the next episode, where we will delve deeper into operations on variables and control structures! Keep coding, and see you in the next lesson!