top of page

Python Help

Welcome To the Python Code help pages aimed to give you in lesson and out of lesson support.

Comments

WHAT                                                                                                        CALLED                     PYTHON CODE

HELP A1- who made the program/ what does this code do                      comment                    #this program was made by
 

Variables

WHAT                                                                                                        CALLED                     PYTHON CODE

HELP B1- stores data / values or calcultation                                           variable                     age=()    or  total=(num1+num2)

HELP B2- declares a variable                                                                   declare                      colour=()

HELP B3- decalres and inititalises a variable                                           initialises                    colour=pink

HELP B4- stores whole numbers that are to be inputted                          variable   / integer      num1=int(input("Enter 1st Number"))

Outputs

WHAT                                                                                                        CALLED                     PYTHON CODE

HELP C1- output something                                                                       output                        print ("Hello") or print ("Hello Number 243")

HELP C2- outputs a message using stored data (from variable)               output                        print ("Hello",name)

Inputs

WHAT                                                                                                        CALLED                     PYTHON CODE

HELP D1- gets data from user and then stores it                                      input / variable            name=input ("Whats your name")

Strings                                                                                                        CALLED                     PYTHON CODE

A string is a sequence of characters. You can loop through the characters in a string, unlike an integer or real number

Splitting Strings

Lets play around with the word "Hawaiin"

pizza="Hawaiin"

​print(pizza[0]) .....will get you >>>>>   H

print(pizza[:5]) ....will get you >>>>>   Hawai
print(pizza[0:2]) ..will get you >>>>>   Ha
print(pizza[6]) .....will get you >>>>>   n
print(pizza) ..........will get you >>>>>   Hawaiin
print(pizza[2:4]) ...will get you >>>>>   wa
print(pizza[3:]) .....will get you >>>>>   aiin

Joining Or Concatenating Strings

name="Ellizabeth"

greeting="Hello"

print(greeting + name)     .....will get you >>>>>  ​HelloElizabeth
print("Hi", name)  .................will get you >>>>>   Hi Elizabeth
print(name," ",name)    ........will get you >>>>>   Elizabeth   Elizabeth  
print(name * 2)   ...................will get you >>>>>   ElizabethElizabeth
print(greeting,"",name[1:4])  will get you >>>>>   Hello  liz

CHEAT SHEETS

Arrays > PDF Cheat Sheet / Bootcamp / Website
Conditional Statements > PDF Cheat Sheet / Bootcamp / Website
Conditions > PDF Cheat Sheet / Bootcamp / Website
CSV > PDF Cheat Sheet / Bootcamp / Website
Fixing Errors > PDF Cheat Sheet / Bootcamp / Website
Functions > PDF Cheat Sheet / Bootcamp / Website
Iterations > PDF Cheat Sheet / Bootcamp / Website
Lists > PDF Cheat Sheet / Bootcamp / Website
Loops > PDF Cheat Sheet / Bootcamp / Website
Maths > PDF Cheat Sheet / Bootcamp / Website

Operators > PPT Cheat Sheet
String Manipulation > PDF Cheat Sheet / Bootcamp / Website
Strings > PDF Cheat Sheet / Bootcamp / Website
Syntax > PDF Cheat Sheet / Bootcamp / Website
Text Files > PDF Cheat Sheet / Bootcamp / Website
Variables > PDF Cheat Sheet / Bootcamp / Website

bottom of page