1/15
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
What is input in programming?
Data that enters a program (often from the keyboard/user).
Stuff you type into the program (Spyder Script)
What does input() do?
Reads one line from standard input (keyboard) and returns it.
Data that enters a program (often from the keyboard/user)\
Stuff that you type into the program
What type does input() return by default?
A string
What does print() do?
Displays output to the standard output (console)
Stuff the program shows you
What does sep do in print()?
sets the separator between items
what goes between things
What does end do in print()?
sets what prints at the end
what happens at the end
Syntax Error
Python/Spyder can’t run at all
program never starts
Types of Syntax Errors
Miss-capitalization
Leaving out quotes
Mismatching quotes
Not matching brackets
Syntax Error: Miss-capitalizing a word
Using the wrong letter case for Python keywords or functions
ex) Print("Hello World!")
“Print” is not defined
Must be “print”
Syntax Error: Leaving out quotes
Texts must be enclosed in quotation marks; missing out causes an error.
ex) print("Hello World!)
Missing the last “ after !
This string never ends
Syntax Error: Mismatching quotes
A string must start and end with the same type of quotation mark
ex) print("Hello World!')
“ does not match with ‘
Syntax Error: Not matching brackets
Every opening bracket or parenthesis must have a corresponding closing one
ex) print("Hello"
Missing )
What is a logic (runtime) error?
An error that occurs while the program is running, even though the syntax is correct
Python understands your code, but something goes wrong when it runs
Types of Logic (Runtime) Errors
Dividing by zero
Wrong output (typo/wrong logic)
Forgetting to output something
Using the wrong calculation or operation
Logic (Runtime) Error: Dividing by zero
The p