Python Flashcards
(142 cards)
how do you write a comment in Python?
with the hash symbol #
how are variables assigned in python?
with the = sign
can variable names begin with numbers?
no
what does the error syntax error mean?
syntax error means that there is something wrong with the way the program is written
what does the Name Error error mean?
when the Python interpreter sees a word it doesn’t recognise
what does Python do before performing division?
converts all integers into floating point numbers
what is exponentiation?
the process of raising a quantity to some assigned power (using superscript numbers - x to the power of y)
what notation is used for exponentiation?
**
what is string concatenation?
the process of adding strings together
what is the plus equals += operator for?
to add to the current value of a variable
what notation do you use for a multi-line string?
three quotation marks, either “”” or ‘’’
what function is used to allow users to assign a value to a variable?
the input ( ) variable
a boolean expression is a ____ that can either be ___ or ___
a boolean expression is a statement that can either be true or false
what operators do you use to create a boolean expression?
relational operators
relational operators ___ two items and return either ___ or ___ false
relational operators compare two items and return either True or False
what are relational operators also known as?
comparators
what is the notation for the not equals relational operator / comparator?
!=
what is the notation for boolean equals operator?
==
what type are True and False known as?
True and False are their own type of bool
are True and False the only bool types?
yes
what is a variable assigned a bool as a value called?
a boolean variable
give two ways to create a boolean variable
a) assign a bool True or False to a variable
b) set a variable equal to a boolean expression
boolean variables are the building blocks of ____ _____
boolean variables are the building blocks of conditional statements
what notation takes the place of ‘then’ in a conditional statement in english (if x then y)
then is written with a colon :