Programs are typically written in a special application called an Integrated Development Environment (IDE)
Decomposition: The practice of breaking a program into smaller pieces
How to display an Image:
From PIL import Image
image = Image.open(‘file.jpg’)
(Remember the picture has to be in the same folder as the program/ python file)
image.show()
Min and Max:
min([‘thing’, ‘thing2’, ‘thing3’]): finds the lowest value, and if it is a string it is alphabetical
max([‘thing’, ‘thing2’, ‘thing3’]): finds the highest value, and if it is a string it is alphabetical
ASCII and chr(): ASCII is kinda like morse code, where every single number from 0-255 has a corresponding character like “*” or “3” or “a”.
You can use chr() to find what your number is, so just put a number in the parenthesis and you will get a character as the output
Ex. Print(chr(77))
Output in console = M
.upper(): turns the string into upper case
.lower(): turns the string into lower case
.capitalize(): Turns the first character into upper case
Ex. Names, Countries, etc.
Collection: what lists, dictionaries and tuples are
Errors
Syntax Error: There is something wrong with how the program was written
Syntax errors for Booleans are kinda rare
Bugs: Isn’t really an error, but the program just doesn’t work as indented
Key error: If a key doesn’t exist in the dictionary
One Response
Error 🙂