Quiz 1 Flashcards
computer program
consists of instructions: input, process, and output
python
- conceived in late 80s by guido van rossum
- named after british comedy group “monty python”
- most popular = python 3.x
python interpreter
computer program that executes code written in the python programming language
IDE
programmming development is usually done with an integrated development environment (IDE) (vs code = our ide)
basic output
function print = string literal - letters/numbers/spaces/symbols (* or #) surrounded by pair of matching single or double quotes
basic output - variables
comma is used to ouput multiple items in one statement (separates multiple items)
basic output - variables
comma is used to ouput multiple items in one statement (separates multiple items)
errors
SyntaxError - violating programming language’s rules
TypeError - operation uses incorrect types
NameError - uses variale that does not exist
ValueError - invalid value is used (giving letters to int())
parts of a program
- library imports
- functions
- expressions
- statements
- variables
parts of a program
- library imports
- functions
- expressions
- statements
- variables
library imports
things other people have written (or you wrote outside of the script
statement / expression
program instruction that tells python to do something / evaluates and returns a value
function
block of reusable code you write yourself
tokens
keywords: def, import, if else
operators: – + - * / // % =
delimiters: () [] {} , ; : #
literals: 123 7.6 true
whitespace
- ignored in expressions and statements
- beginning of line = indentation
- python uses indenation/whitespace for syntax
- cannot appear in middle of an operator