1
00:00:00,009 --> 00:00:05,510
Welcome to lesson two. And previously, we successfully created

2
00:00:05,739 --> 00:00:10,899
our very first program that printed the words Hello world.

3
00:00:11,189 --> 00:00:15,909
Now, I wanted to use this opportunity to really break this

4
00:00:16,079 --> 00:00:18,010
program down and

5
00:00:18,190 --> 00:00:21,909
help you understand what exactly we did because

6
00:00:22,059 --> 00:00:24,280
I'm going to assume it's your first ever program

7
00:00:24,290 --> 00:00:26,670
and you're new to the world of programming.

8
00:00:27,180 --> 00:00:27,719
So

9
00:00:28,049 --> 00:00:33,669
right here we initiated the command called print. Now, print is a function

10
00:00:34,169 --> 00:00:39,430
with Python. You have inbuilt functions that will do something for you.

11
00:00:39,889 --> 00:00:43,409
Print is one of such functions that will of course print

12
00:00:43,419 --> 00:00:45,799
out whatever it is that we tell it to print.

13
00:00:46,450 --> 00:00:51,029
Now notice that we do have the parentheses,

14
00:00:51,290 --> 00:00:52,810
OK? Opened up. And

15
00:00:53,029 --> 00:00:56,430
typically whenever you're working with functions with Python,

16
00:00:56,639 --> 00:00:58,240
you will have the name of the function.

17
00:00:58,250 --> 00:01:01,790
And then you're gonna have parentheses which are the brackets

18
00:01:02,229 --> 00:01:04,529
and inside of the parentheses,

19
00:01:04,540 --> 00:01:07,750
you're going to have something that we call a variable.

20
00:01:07,760 --> 00:01:08,150
OK?

21
00:01:08,849 --> 00:01:10,500
Variables are kind of like

22
00:01:10,949 --> 00:01:13,269
inputs or data

23
00:01:13,480 --> 00:01:17,150
that we give to the function to work with.

24
00:01:17,550 --> 00:01:18,199
OK. In

25
00:01:18,430 --> 00:01:20,510
this case right now, the

26
00:01:20,669 --> 00:01:24,330
variable is the text. Hello World.

27
00:01:24,650 --> 00:01:27,029
Now we're letting Python know

28
00:01:27,559 --> 00:01:31,300
that Hello world is text. It's a string format.

29
00:01:31,309 --> 00:01:34,709
Don't worry, we're gonna talk a bit more about data types a bit later.

30
00:01:35,150 --> 00:01:40,690
But in order for Python to understand that Hello World is actually a piece of text,

31
00:01:40,989 --> 00:01:45,620
we wrapped it in double quotation marks. As you can see.

32
00:01:45,629 --> 00:01:48,099
That's why Python knows that all

33
00:01:48,239 --> 00:01:52,250
these aren't numbers. This is not some sort of a calculation.

34
00:01:52,430 --> 00:01:55,910
These are just letters or words that need to be printed out.

35
00:01:56,110 --> 00:01:59,160
That's why we wrap them in quotation Mac.

36
00:01:59,620 --> 00:02:04,220
Now, if I was to come over here right now and typed in something,

37
00:02:04,230 --> 00:02:05,709
just something random

38
00:02:05,940 --> 00:02:09,800
notice, it's of course, outside of the quotation marks.

39
00:02:10,139 --> 00:02:10,589
OK.

40
00:02:11,279 --> 00:02:14,600
If I was to go ahead right now and run my program,

41
00:02:14,610 --> 00:02:18,380
you will see right now that it displays an error because

42
00:02:18,699 --> 00:02:21,240
the syntax isn't correct.

43
00:02:21,529 --> 00:02:23,690
If you're going to display anything

44
00:02:23,899 --> 00:02:25,960
using Python and the print function,

45
00:02:26,190 --> 00:02:32,339
it needs to be in quotation mark. So this isn't going to work. Let me go back,

46
00:02:33,559 --> 00:02:34,699
add my

47
00:02:34,889 --> 00:02:36,529
double quotation again,

48
00:02:37,139 --> 00:02:38,039
run

49
00:02:38,520 --> 00:02:40,039
and we're back. OK?

50
00:02:40,770 --> 00:02:46,649
What if I wanted to print? Hello World, let's say five times. OK?

51
00:02:46,839 --> 00:02:49,600
Now I could do this. OK?

52
00:02:49,610 --> 00:02:54,470
I could simply just copy and then come over here, paste, paste, paste, paste.

53
00:02:54,750 --> 00:02:56,860
And then if I was to run,

54
00:02:57,339 --> 00:03:01,309
you can see right now it will print out Hello World five times.

55
00:03:01,320 --> 00:03:02,399
Pretty straightforward.

56
00:03:02,889 --> 00:03:05,559
OK? Let me just go ahead and remove

57
00:03:06,039 --> 00:03:07,679
the four additional lines.

58
00:03:08,710 --> 00:03:10,889
I want to show you a different way.

59
00:03:11,039 --> 00:03:11,729
OK.

60
00:03:12,100 --> 00:03:14,350
We could do something like this. OK?

61
00:03:14,729 --> 00:03:21,039
I am going to create something that I've mentioned before and that's a variable. OK?

62
00:03:21,050 --> 00:03:23,660
Variables. Again, they're like inputs

63
00:03:23,839 --> 00:03:25,929
that we can use to store data.

64
00:03:26,300 --> 00:03:31,610
Now, I'm going to call this variable, let's say text, let's call it text one.

65
00:03:31,970 --> 00:03:32,610
OK?

66
00:03:33,020 --> 00:03:36,600
That's the name of my variable. And I'm gonna say it's equal to

67
00:03:36,970 --> 00:03:39,070
and now in double quotation marks.

68
00:03:39,710 --> 00:03:40,839
Hello

69
00:03:41,630 --> 00:03:42,529
world.

70
00:03:42,850 --> 00:03:43,369
OK.

71
00:03:43,710 --> 00:03:46,699
So what I've done right now is I have simply said,

72
00:03:47,000 --> 00:03:51,990
I'm going to add the text. Hello World to the variable text one.

73
00:03:52,000 --> 00:03:57,940
So text one, the variable text one is now holding it has the value of hello world.

74
00:03:57,949 --> 00:03:59,179
Now check this out. OK?

75
00:03:59,449 --> 00:04:02,330
I'm gonna go over here right now to my print function,

76
00:04:03,130 --> 00:04:04,679
remove

77
00:04:04,940 --> 00:04:06,410
the text, the string

78
00:04:06,830 --> 00:04:09,380
and I'm simply gonna say text

79
00:04:09,490 --> 00:04:10,399
one

80
00:04:11,809 --> 00:04:16,250
because again, text one is equal to hello world.

81
00:04:16,540 --> 00:04:17,269
And now

82
00:04:17,459 --> 00:04:19,029
I'm going to run my command

83
00:04:19,420 --> 00:04:22,769
and here it is we have Hello world.

84
00:04:22,899 --> 00:04:27,459
And of course, I could simply copy this once again

85
00:04:27,910 --> 00:04:30,829
and then I could paste, paste, paste, paste,

86
00:04:31,329 --> 00:04:32,589
run the command

87
00:04:32,959 --> 00:04:36,170
and take a look at that. All of a sudden

88
00:04:36,339 --> 00:04:38,989
we have an issue. Why?

89
00:04:39,339 --> 00:04:41,309
Well, that's because Python

90
00:04:41,779 --> 00:04:43,269
reads

91
00:04:43,859 --> 00:04:48,190
print text one and then again, immediately it sees another print text one,

92
00:04:48,200 --> 00:04:50,510
print text one, print text one

93
00:04:50,619 --> 00:04:52,619
that confuses Python.

94
00:04:52,630 --> 00:04:58,829
So what you want to do right now is we want to add these in separate lines.

95
00:04:58,839 --> 00:04:59,940
It's typically

96
00:05:00,160 --> 00:05:03,119
very good programming syntax, if we're going to run

97
00:05:03,239 --> 00:05:05,230
more than one function,

98
00:05:05,489 --> 00:05:08,339
you want to run them in separate lines,

99
00:05:08,429 --> 00:05:11,799
you should never run multiple functions within the same line.

100
00:05:11,809 --> 00:05:12,230
So

101
00:05:12,769 --> 00:05:13,929
I'm gonna go back in here,

102
00:05:14,070 --> 00:05:15,140
click on run

103
00:05:15,540 --> 00:05:19,470
and there it is, everything is back to normal.

104
00:05:19,690 --> 00:05:20,230
So

105
00:05:20,540 --> 00:05:24,950
that's just a very small snippet of what we're going to be dealing with.

106
00:05:24,959 --> 00:05:26,829
Obviously, we're going to be dealing with far more

107
00:05:27,200 --> 00:05:30,880
advanced functions and programs, but you know,

108
00:05:30,890 --> 00:05:33,799
step by step we're going to get there.

109
00:05:33,809 --> 00:05:34,989
So hopefully

110
00:05:35,299 --> 00:05:39,850
you now understand a bit better what variables are functions

111
00:05:40,299 --> 00:05:45,160
and how the syntax for Python works. Thank you for watching.

112
00:05:45,170 --> 00:05:46,959
I will see you in the next class.