Resources For Learning Python
A Quick Background/Definition:
Python is an interpreted, easy-to-use programming language that is widely applicable. It boasts simple syntax, and intuitive commands that make learning simple and straightforward. The goal of this guide is to compile a list of great resources for learning Python, from basic concepts to advanced structural ideas.
The Python website contains a great Executive Summary on what Python is, and why it is employed in application development.
Python for Absolute Beginners:
Programiz has a great collection of tutorials, covering the simple basics of print statements and variable types up to more complex topics such as dictionaries and development styles. In addition, each topic is segmented, allowing for visualized progress, and brief learning sessions.
There are countless great video tutorials on the internet, including interactive sessions where the student is encouraged to follow along. In order to follow along however, the student must first correctly install Python, as well as a recommended IDE (Integrated Development Environment).
Aside: IDEs
IDEs (Integrated Development Environments) are an important weapon in any Python programmer’s arsenal. A good IDE can improve the quality of your written code, and allow you to quickly debug and solve your previously error ridden scripts. A personal favourite – and a popular one at that – is PyCharm. PyCharm provides real time assistance, checking your code and identifying errors, along with providing you a debug report on what exactly is invalid. Instead of using the native python terminal, and receiving basic error messages, PyCharm helps you fix your code before an error is even encountered. In addition, PyCharm has a great formatting tool that can help you format your code in real time. With third-party application support, your PyCharm can be modified to suit your development needs.
PyCharm Community Edition can be downloaded free-of-charge.
Now with your software installed, let’s look at some basic concepts related to Python structure.
White-Space Delineation
White space delineation is an issue encountered by some programmers who have learned other previous languages, such as C or JavaScript, where you are required to indicate the end of a line with a semicolon “;”. Python instead requires a space “ “ in order to indicate the end of a line or statement.
An illustration of this concept can be found in Python Beginner Tutorial 1 (For Absolute Beginners), a beginner video by kjdElectronics. The video covers Python installation, as well as white space delineation, a concept you should familiarize yourself with.
Variables
In order to actually accomplish tasks while coding, the user must understand variables, how they are stored, and how you can use them to your advantage. Basic variables types and variable storage methods are covered in Introduction to Python – Chapter 1 – Intro and Variables.
MicrowaveSam creates a comprehensive and dynamic tutorial of basic python theory, including an interesting introduction covering computer science theory and computation. Allows students to develop a baseline understanding of variables and functions that demonstrates the intuitive nature of python (i.e. no variable type declaration needed). The video covers variable naming conventions and print functions, including the ability to display a variable type with a print function.
PEP 8 – A Universal Style Guide
PEP 8 is a style guide written by the developers of the Python language meant to standardize and improve the quality of Python projects. This style guide can be applied to any block of code, and assists in communication between computer programmers. Think of it like a programming grammar dictionary. The original document is lengthy and difficult to navigate, making pep8.org a better option for overall navigation. The PEP line of documents is a great place to begin when trying to learn Python style and syntax, as well as basic communication skills within a .py document.
Interactive Tutorial
The best learning resources for coding on the internet include a portion where the student is asked to follow along. This Interactive Python Tutorial contains small lessons on numerous topics, as well as providing an opportunity for the student to apply their new knowledge at the end of each lesson. The webpage covers “Hello, World!” printing to advanced data science tutorials, with each lesson providing an opportunity to develop your toolbox of functions and commands.
A Challenge from Me to You
Develop your skills. Python is a wonderful tool that can be applied in countless ways, and information regarding concepts is so readily available. I’ve included some project ideas to get you started on higher level development. Once you feel confident in your basic abilities, such as variable declaration and printing, attempt these problems to apply your skills on a larger scale.
Guessing Game:
I’m thinking of a number between 1 and 100. Chances are, you can guess this with Python! Code a guessing game using a Binary Search method, where the computer constantly guesses the middle number between two bounds. Ask the user for input on whether your guess was right, and then change the bounds to accommodate whether the actual number was lower or higher than the original guess. Use your knowledge of print and input functions in Python to get user input, and use a for loop to loop through guesses. Use a counter variable to count the number of guesses it took to get the right answer.
Card Shuffling:
You have a deck of 52 cards. Shuffle it using a function CardShuffle and print out 5 random cards using a function CardPrint. This problem is more advanced, as it requires knowledge of user-defined functions and the ability to produce random numbers from within a specific boundary. Consider reviewing tutorials on lists in Python, as you can express the card number and suit as a mixture of two lists! Good Luck!
“A computer once beat me at chess, but it was no match for me at kick boxing.”
— Emo Philips
Sam Alexander
IT FYPCO 2019-2020