Python Syntax Flashcards
Variable? Example?
A variable stores a piece of data and gives it a specific name.
Eg. “Spam - 5”; the variable spam now stores the number 5
Boolean? Example?
A boolean is like a light switch. It can only have two values, and can only be on (True) or off (False). It is an example of a data type
Eg. a = true, b = false
Whitespace?
Used to structure code in Python. It separates statements. If the Whitespace is wrong, errors may be returned
Eg. IndentationError
Interpreter
Runs code line by line and checks for any errors
Single Line Comments
Lines that start with a “#” or hash are IDed by Python as comments and are not run as code.
Multi-Line Comments
Multi-line comments are noted “”” comments go in here “”” - three quotation marks on each side. Everything in this block will be identified as comments
Exponentiation
Math combined with other types and commands in Python to create useful programs
eg. eight = 2 ** 3
Modulo
Returns the remainder from a division
eg. 3 % 2 will return 1 because 2 goes into 3 once and 1 remains
Data Type? Example?
A data type is a piece of information, such as a number or boolean.