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.
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.
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:
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.
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.
So, we have learned about installing and using Python within MacOS and Linux, and those two operating systems have a similar process because they’re both derived from the UNIX operating system. However, setting up Python on Windows is a bit different, so in this video we will walk-through the process. First, go to https://www.python.org/downloads/ and select the latest Python 3 version. If you need to check whether you have a 32 or 64 bit system, right-click on the Windows icon on the bottom left of your desktop, and select system. Once you have downloaded the file, open up the installer and make you check the box to add Python to path, and then click install now. This procedure should work for Windows 7, 8, and 10.
I go into great detail covering how to verify that the PATH is set to the correct version of Python, and installing new packages using pip in the command prompt, but I think it is much easier to show the steps in the video 🙂
The first thing that we need to do to get into programming with Python is installing it. In this video we will discuss the three different methods for installing Python on your system. First, we will discuss MacOS because that is the system I will be using. So, what we’re going to do is open up the terminal and run a Ruby command to download and install Homebrew:
Homebrew is a package manager that enables you to install various programs without having to search for a source on the internet. If you have used Linux, using a package manage should be very familiar to you. You can find more information on Homebrew at https://brew.sh/. Next, we will run the following command in terminal:
brew install python3
MacOS does ship with a version of Python 2 pre-installed, but we will be using Python 3 in this tutorial series. To verify that Python 3 was installed, run the follow command:
python3 --version
If you are using Ubuntu, or some other Debian based Linux distribution, you are going to open up a terminal window and run the following command:
sudo apt-get install python3
Similar to Mac, you can type python3 –version to verify that it was installed correctly. Fedora now comes with Python 3 as a system dependency, and if you are using RHEL/CentOS you will type the following command in terminal to install Python 3.6.1:
sudo yum install python36u
If nothing seems to happen or if you receive an error message, check to see if Python 3 is already installed on your system. Lastly, to install Python 3 on Windows you will need to go to https://www.python.org/downloads/. You will download either the 32 or 64 bit version depending on your operating system, and proceed through the installation. I will cover how to install Python 3 on Windows 10 in the next video.
Hello everyone and welcome to the first video of this Python tutorial series. This tutorial series is going to be aimed at somebody who may have basic knowledge about what a programming language is, but this would be your first programming language. Python is a great programming language to start with! It does have it’s limitations, and sometimes it is not the right tool for the job, but Python offers people who have no experience programming a great way of understanding what a programming language is and how to use one. Throughout this series of videos we will discuss what Python is, how to get it installed, how to run a Python script, the basic syntax, and then get into the language itself. We will finish by writing a fully functional program. I hope everyone enjoys this Python tutorial series and finds it useful!
In this JavaScript tutorial we will cover flexible function parameters. The point of object-oriented programming is that we don’t want to rewrite code, and flexible parameters allow us to perform computations on multiple bits of data.
In this JavaScript tutorial we will cover how to pass a function multiple parameters. I will also show you how to use the type of operator to identify whether something is a number, string, boolean, object, function, or undefined.