Posted on

Learn Python Episode #13: Variables

Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

In this video we are going to cover variables in Python, and as you may have guessed, a variable is an object that is variable in nature. So, why do we use variables in our code? Well, when we explicitly write strings they are not reusable. If I were to simply write “This is a sting,” I would be unable to reuse that line of code later on in my script. So, one reason we use variables is for re-usability. Another reason we use variables is for passing values into functions, but we will get into that in a later video. The nice thing about Python is that we don’t need to declare or define the type of variable. Creating a variable is as simple as this:

greeting = "hello world"

When you hit enter in your terminal or command prompt, Python will not output a response. However, when we call our new variable, Python will print out “hello world”

print(greeting)

Now that the greeting variable is stored in memory, we can make changes to it.

greeting = greeting.split (" ")[0]

If we print(greeting) now it will returns hello. We can write the following to return hello nick:

print(greeting + " Nick")

In the next video we’re going to be talking about some of the built-in functions available to you in Python.

Web – https://josephdelgadillo.com/
Subscribe – https://goo.gl/tkaGgy
Follow for Updates – https://steemit.com/@jo3potato

Posted on

Learn Python Episode #12: Dictionaries

Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

In this video we will cover dictionaries in Python. In the previous video when we created a list we used square brackets and comma separated values. To create a dictionary we will use curly brackets instead of the square brackets. In a previous video I may have mentioned that we do not use curly brackets in Python, and that was a lie. What I meant is that we don’t need to wrap code blocks in curly brackets like PHP or JavaScript. So, let’s go ahead and define a dictionary.

{"name": "Nick", "age": is 27, "hobby": "code"}

As you can see, instead of just comma separated values we used in the list, the dictionary uses a key and a value separated by a colon. You can access an item in the dictionary like so:

{"name": "Nick", "age": is 27, "hobby": "code"}{"name"}

Python will then print out “Nick.” Dictionaries will be very important when we get to the JSON part of the course, because we will need to parse though a ton of data.

Web – https://josephdelgadillo.com/
Subscribe – https://goo.gl/tkaGgy
Follow for Updates – https://steemit.com/@jo3potato

Posted on

Learn Python Episode #11: Lists (Arrays)

Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

In this video we are going to discuss lists and what they are in Python. So, if you have experience with programming in other languages, let’s say PHP, you know to create an array, and what an array is. For those who do not have experience programming, an array is a way of keeping data organized and within a single construct. For single-dimensional arrays, we can implement it as a list in Python. To create a list in Python we use square brackets:

["Movies", "Games", "Python"]

This becomes a list that has 3 indexes. To call the first item in the list you write the following:

["Movies", "Games", "Python"][0]

Remember, when programming the first ID of the item in a list or an array will be 0. We can also concatenate a list item with a string.

print("I Like" + ["Movies", "Games", "Python"][0])

If we were to change the index to number to 1 it would print out “I Like Games”. So, that is what a list is in Python. It’s just a way to create a collection under one variable. In the next video we will cover dictionaries.

Web – https://josephdelgadillo.com/
Subscribe – https://goo.gl/tkaGgy
Follow for Updates – https://steemit.com/@jo3potato

Posted on

Learn Python Episode #10: Boolean Operators

Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

In this video we’re going to be talking about Boolean operators. So, what is a Boolean? This is a general programming concept, and a Boolean consists of two items – true and false. Basically, truth checking. So, let’s have a look at some of the ways we can generate a true or false. Let’s start with 5=5. In math terms this is true, but a single equal sign is used to assign a value to a variable in Python. When comparing two numbers or strings you will need to use double equal signs like so.

5==5

Python will return True. If we try 5==4, Python will return False. We can also write the following:

5 is 5

Python will return True. If we were to write 5 is 4, Python will return False. Similarly, 5 is not 4 will return True. We can also compare strings.

"I like pizza"=="I like pizza"

Python will return true. In the next video we will cover Python’s version of arrays which are called lists.

Web – https://josephdelgadillo.com/
Subscribe – https://goo.gl/tkaGgy
Follow for Updates – https://steemit.com/@jo3potato

Posted on

Learn Python Episode #9: String Manipulation

Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

What are some of the fun and useful things that we can do with strings in Python? Go ahead and open up a either your IDE, terminal, or command prompt and follow along. I find that if you’re simply told to do something you may not remember the procedure next time. However, if you actually perform that actions yourself, it is much more likely to stick. So, the first thing we are going to cover is concatenating strings. Concatenating is essentially gluing two things together. Below is an example of concatenating two strings together:

"Hello, " + "Nick"

As you can see, you concatenate two strings by using the “+” operator. You can also use the string function to convert an integer to a string like so:

"This costs" + str(6) + "dollars

You can also perform mathematical operations within the string function parameter.

"This costs" + str(6+5) + "dollars"

So, how do we do the opposite of concatenation? We can split strings by using the “:” operator.

"Hello:Nick"

This all may not seem very exciting, and you may or may see how this could be useful, but you will see later on why concatenating is useful when coding.

Web – https://josephdelgadillo.com/
Subscribe – https://goo.gl/tkaGgy
Follow for Updates – https://steemit.com/@jo3potato

Posted on

Learn Python Episode #8: Strings

Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

Alright, so what is a string? A string is any text that you want to be treated as text within a program. This is a string because it’s wrapped in quotations:

"Hello String"

You can also use single quotations to create a string. In this video we will write a few different string variations which include quotes and apostrophes. In the next video we will continue with string manipulation.

Web – https://josephdelgadillo.com/
Subscribe – https://goo.gl/tkaGgy
Follow for Updates – https://steemit.com/@jo3potato

Posted on

Learn Python Episode #7: Numeric Types

Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

Before we actually get into functional programming with Python we need to discuss some basic types, and then variables, and some other stuff. So, in this video we ‘re going to be covering numbers. So, what is a number? Well, I’m sure everyone knows what a number is. We have all been through grade grade school. For our purposes, there are two types of numbers – integers and floating points. A floating point is basically any number that has a decimal included in it. In this video we will write some numbers on the screen, perform a few mathematical operations, and convert numbers into strings.

Webhttps://josephdelgadillo.com/
Subscribehttps://goo.gl/tkaGgy
Follow for Updateshttps://steemit.com/@jo3potato

Posted on

Learn Python Episode #6: Choosing an IDE

Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

What kind of working environment do we need to be efficient at programming with Python? Feel free, if you would like, to open up a basic text editor, write a script, and then go to the terminal or command prompt and run it. That would be very inefficient for a variety of reasons, and so we’re going to be using an integrated development environment (IDE). The IDE we will be using in this tutorial series is called PyCharm, and it was built by a company called JetBrains. The community version is completely free and you can download it here:

https://www.jetbrains.com/pycharm/download/

PyCharm utilizes Java, so if it isn’t already installed you can find it here:

https://java.com/en/download/

Let’s take a quick tour around PyCharm and then get into the language itself.

Webhttps://josephdelgadillo.com/
Subscribehttps://goo.gl/tkaGgy
Follow for Updateshttps://steemit.com/@jo3potato

Posted on

Learn Python Episode #5: Creating and Running our First Script

Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

Let’s create a Python script and learn how to run it. I’m going to be doing this within terminal, and you can follow along on MacOS, Windows, or Linux. First, I am going to change into my “pycharm projects” directory and there’s nothing really here, so I’m going to create a file using the nano text editor. If you are Windows, you will not have access to nano in the command prompt. I’m just going to call the file test.py. All Python scripts need to have the .py file extension. We will use the classic programming example of print(“Hello World”). I will save the file, and if we just type “test.py” you will see that BASH doesn’t know what to do with this command since test.py is not an installed program. What we need to do is run “python3 test.py” and it will return the result of anything within the script. So, that was a quick video on how to run Python scripts in terminal, in the next video we will setup our integrated development environment.

Webhttps://josephdelgadillo.com/
Subscribehttps://goo.gl/tkaGgy
Follow for Updateshttps://steemit.com/@jo3potato

Posted on 1 Comment

Learn Python Episode #4: Interpreted vs Compiled Programming Languages

Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

In this video we are going to talk about the difference between an interpreted programming language and a compiled programming language. Now, this may be a bit adept for the novice programmer, but just stick with us. So, first, with a compiled programming language you write your code, you save it into a file, and it is not yet executable. For example, let’s say you are writing C++ code, you write a script, and if you try to open that file with the .cpp extension (which is for C++ files), it is just going to open that in a text editor or code editor. What you need to do with a compiled programming language, is once you save your file you need to compile it into a language that the computer can read, so binary (zeros and ones), and by compiling this filing into and executable file, then you can double click it and it will run. This is where you will get the .exe file for Windows.

So, with Python you can write a script and you can instantaneously run that script without having to compile it into binary. When you run Python scripts you’re going to run it with the Python command, and then the name of the file, and what happens is you’re running the program Python which is interpreting your code in real-time. So, it does compile your code into binary, but it does what is called just-in-time compilation. The interpreter is great to use if you want to test something quickly, or if you want to debug a few lines of code.

Webhttps://josephdelgadillo.com/
Subscribehttps://goo.gl/tkaGgy
Follow for Updateshttps://steemit.com/@jo3potato