PYTHON PROGRAMMING for beginners
A Step-by-Step Guide to Learn one of the Most Popular and Easy Programming Languages. Learn Basic Python Coding Fast with Examples and Tips.
Julian James McKinnon
Copyright 2020 - All rights reserved.
The content contained within this book may not be reproduced, duplicated or transmitted without direct written permission from the author or the publisher.
Under no circumstances will any blame or legal responsibility be held against the publisher, or author, for any damages, reparation, or monetary loss due to the information contained within this book. Either directly or indirectly.
Legal Notice:
This book is copyright protected. This book is only for personal use. You cannot amend, distribute, sell, use, quote or paraphrase any part, or the content within this book, without the consent of the author or publisher.
Disclaimer Notice:
Please note the information contained within this document is for educational and entertainment purposes only. All effort has been executed to present accurate, up to date, and reliable, complete information. No warranties of any kind are declared or implied. Readers acknowledge that the author is not engaging in the rendering of legal, financial, medical or professional advice. The content within this book has been derived from various sources. Please consult a licensed professional before attempting any techniques outlined in this book.
By reading this document, the reader agrees that under no circumstances is the author responsible for any losses, direct or indirect, which are incurred as a result of the use of the information contained within this document, including, but not limited to, errors, omissions, or inaccuracies.
Table of Contents
Introduction
There are a lot of reasons why you will love working with the Python code.
It is easy to use, easy to learn, has a lot of great frameworks and libraries to work with (and we will discuss at least a few of these as we go through this guidebook), and is still powerful enough to make machine learning easy for you.
While it is possible to work with other coding languages to help you get the results that you want, but most people prefer to work with Python due to all of the benefits that we have discussed.
Before we take a look at how to set up the Python environment so you can use it properly, lets take a look at a few of the different parts that come with the Python language, so you understand how a few of these codes can work for you.
The parts you should know about the Python code
First, we need to take a look at these important keywords in the Python language.
Like with what you will find in other coding languages, there is a list of keywords in Python that are meant to tell your text editor what to do.
These keywords are reserved, and you should only use them for their intended purposes if you want to be able to avoid issues with your code writing.
They are basically the commands that will tell your compiler how to behave, and they remain reserved so that you can execute the code without a lot of issues in the process.
Variables are important because they will save up spots on your computers memory in order to hold onto parts of your code.
When you go through the process of creating a new variable, you are making sure that you are reserving some space on your computer for this.
In some cases, such as when you are working with data types, your interpreter will do the work of deciding where this information should be stored because that speeds up the process.
When it comes to working with variables, your job will be to make sure that the right variables are lining up with the right values.
This will ensure that the right parts show up in your code at the right time.
The good news is that you can give the variable the value that you want, but do check that it actually works inside of your code.
When you are ready to assign a new value to a variable, you can use the equal sign to make this happen.
Lets look at a good example of how this would work:
#!/usr/bin/python
counter = 10 # Assigning an integer
kilometers = 100.0 # Assigning a floating-point
fname = "Jordan" # Assigning string
print counter
print kilometers
print fname
With the above example, you will get the results to show up with the variable that you placed with the value.
So, when the counter shows up, it will show you a 100 for the counter, 1000 for the miles, and John as the result of the name.
Next are the Python comments.
These are helpful to leave a little note in your code and can make a difference in how others are able to look through the code and know which parts are supposed to work with.
Working with the comments can be relatively easy when you are on Python.
You simply need to add the # sign in front of any comments you would like to write.
The compiler will know how to avoid that part of the code and will skip over it, without any interruption in the program.
One thing to note is how many comments you write.
While you can technically write out as many of these as you would like or that you think the code needs, try only to keep the absolutely necessary ones.
You do not want to write in so many comments that it is hard to read the rest of the code.
Just write in comments when they are needed, not all of the time.
Python statements are a simple part of the code that can make a big difference, so we are going to take some time to explore them real quick here.
Statements are going to be the part that the compiler is going to execute for you.
You can write out any kind of statement that you want, but make sure they are in the right place, and that you are not using any of the keywords with them, or the compiler will get confused.
And the next thing that you need to take a look at here is the functions.
Functions can be another part of your language that you need to learn about.
This is basically a part of the code that can be reused, and it can help to finish off one of your actions in the code.
Basically, these functions are often really effective at writing out your code without having a lot of wasted space in the code.
There are a lot of functions that you can use in Python, and this can be a great benefit to the programmer.
These are just a few of the basics that come with the Python code.
We will take a closer look at doing these a bit more as we move through this guidebook, but these will help you get the basics of the Python language and how you can use it for your advantage in machine learning.
Getting that environment set up
Now that we have had a chance to look at machine learning, some of the ways that you can benefit from and benefit from machine learning, and some of the different types of machine learning that you are able to work with, it is time to introduce some Python into this.
Python is a great coding language that you can work with, no matter what your skill level is when coding.
And when it is combined with some of the ideas that come with machine learning, you are going to be able to see even better results in the long run as well.
That is why we are going to spend some time looking at how you can set up your own environment when working with the Python code.