Python Quick Reference

Updated 13 April 2022

Python is one of the fastest growing programming languages in the world! To help you master this language we have made a quick reference guide and are going to cover a few of the basics things to be aware of when starting out with python.

This guide will run through the basics very basics of python and this to be aware of when started toward on the track toward using all the platforms that can be programmed with it such as Windows, Mac, Linux, and the Raspberry Pi you can also use MicroPython that will let you code hardware like The Circuit Playground Express, Pycom and many others.

Python Quick Reference Cheat Sheet

Types

Python is a dynamically typed language this means that the type of the object is stored with the object. In practice this means that you do not have to declare your types as you do in a language like C. This is great and saves a lot of time working out your types, however on occasion you will run into problems where it assigns a type you are not expecting. One example if you compare a user input of 10 to the number 10 it will not work because the input will be stored as a string.

x = input(“Enter the number 1”)
y = 1
if (x==y):
	print(“The number is the same”)
else:
	print(“something went wrong”)

White Space

Python uses white space to group code statements rather than brackets ({}) or begin and end statements that are common in other languages. block below will loop over the two tabbed print statements but only print over after the grouped code has finished.

for i in range(0,10)
	print(i)
	print(10-i)
print(“over”)

Something to be aware of with this white space is that not all white space is the same so code that has been copied from and external source may give errors due to different types of white space(This can also be a problem when copying in code with " in it).

Getting Help with Python

One of the best things about Python is that there are loads of places get help and find tools to get your project running sooner. We have put together a cheat sheet that gives you all the Python basics right at your fingertips so you won’t need without digging through the Official Python Documentation.

If you have any questions about python or have some advice that you would like to share with new python coders post in the thread below and let us know.

Attachment - A3-Python-Cheatsheet.pdf

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.