Python Jumpstart by Building 10 Apps Transcripts
Chapter: App 1: Hello (you Pythonic) world
Lecture: Core concepts: Variables and calling functions

Login or purchase this course to watch this video and the rest of the course contents.
0:01 The first concept is around this idea of calling functions, print is a function, input is a function
0:07 these are reusable pieces of functionality in our application. Here we are calling a function called main,
0:13 and you can see that you call it with the parenthesis on the end some languages have semicolons to indicate the end of a line,
0:21 thankfully, Python does not have that, and this takes no arguments and it returns no value so you just call like this.
0:28 Now, the input on the other hand, we can call it and we pass it a string, kind of like print, but then it returns whatever the user inputted.
0:36 So we are to create a variable called saying, we are storing the return value from the input function
0:43 which is what the user typed in the saying variable we can work with that later. So that brings us to variables.
0:50 And variables in Python are very very simple, they are sort of no-nonsense, so you just say the name, or the word you want to use for the variable
0:57 and then you assign to it and... SHAZAM!! the variable exists. Some languages you have to specify types and initialization and so on,
1:04 Python is sort of as simple as it can be around variables. So here we have a variable called name, and we are assigning the value of Michael,
1:13 we have a variable called age and we are assigning 42, and we can even increment this value of the age, we are doing a "+=" operations,
1:21 so we are taking the age, adding 1 to it, now the age is 43, so happy birthday to me. We have more complex variables of course,
1:28 here we are creating what is called the list and we are populating the list with 3 strings, so biking, motocross and programming,
1:35 and then we are storing that list holding those objects in the hobbies. So, all of these are directly created upon assignment,
1:43 we can also create variables and store return values from functions, so here we have home address and we call in a function
1:48 and we are storing the result of that function into home address. So let's go back and use these ideas to finish up our "Hello World" app.


Talk Python's Mastodon Michael Kennedy's Mastodon