Show Menu
Cheatography

Python Cheat sheet for exam (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Math Symbol

==
equal to
!=
not equal to
>=
More than or Equal to
<=
Less than or Equal to
*
Multiply
**
Exponent
/
Divide (float­,de­cimal)
//
Divide (interger)
%
Find the remainder (Modulo)

Addition , Multip­lic­ation and Exponents

String + String
Combine together
String + Number
Fail
Number + Number
Plus
String * Number
Combine that string (strin­g..s­tring)
String * String
Fail
Number * Number
Multiply
String ** String
Fail
Number ** Number
Exponent
String ** Number
Fail

Vocab.

String
A list of character such as number, letter and symbols
Integer
whole number
Floating
Decimal
Boolean
True/False
 

Function

print()
Displays inform­ation on the screen
input()
Receive inform­ation from user
int()
Converts value to integer
str()
Converts value to string
float()
Converts value to decimal point
#
Comment
"­" / "­"­"
Multi-line comment
len()
The length of string

Example

Firstname =
input(­"What is your first name?")
Lastname =
input(­"What is your last name?")
Fullname =
(firstname +" "+ lastname)
print
(fullname)
name =
input ("please enter your name;")
surname =
input ("please enter your surnam­e;")
print
("We­lcome to Computer Scienc­e" + name, surnam­e[0])