Getting started with Python 3 - a beginner's cheat sheet

*Python.Org* I have been getting started with python 3 – I want to make this my primary scripting language. One way I like to assist myself whilst I learn the rope is to maintain a crib sheet filled with all the trivial things I would otherwise forget. Python 3 Cheat Sheet #Define Variables programming_languages: "Python", "VB", "C++", "C#" #Print Variables print(programming_languages) print('--------------------') #Basic for loop + variables for language in programming_languages: print(language) print('--------------------') #Basic Function def FuncExample(): i: 1 for language in programming_languages: #Concatinate Strings and Integers in print statements print("Language " + str(i) + ":" + language) #Increment Integer i += 1 FuncExample() print('--------------------') #Functions with Variables #1 - Strings def FuncVarExample1(fname, lname): #Print with CRLF print("First Name: " + fname + "\r\n" + "Last Name: " + lname) FuncVarExample1("Joe","Bloggs") print('--------------------') #Functions with Variables #2 - Integers + Returning Values def FuncVarExample2(x, y): #Basic integer maths return x+y #Concatenating Strings and Integers print("33 + 42: " + str(FuncVarExample2(33,42))) print('--------------------') You can also find more code snippets here: https://exitcode0.net/code-samples/

November 23, 2019 · 1 min · Tom Cocking

How to Upgrade Python on Debian, Ubuntu and Kali Linux (and Set the Default Version Safely)

Updated October 2026: this page replaces six separate posts I wrote between 2019 and 2021 about upgrading Python on Debian 9 and 10, Ubuntu 19.10 and Kali, and switching the python command from 2.7 to 3. The old URLs redirect here. Everything in the first half was re-tested on 8 October 2026 in fresh Debian 12 and Ubuntu 22.04 containers. The original 2019 from-source walkthrough is kept at the end because it still works, with one important correction. ...

February 19, 2019 · 6 min · Tom Cocking