Chapter 1 - Data Types Flashcards
What is a string
A string is simply one or more characters enclosed in qoute marks
What symbol joins two or more strings together
+
If a number is in quotation marks is it still a number?
no it behave as a strings
What is a integer?
a whole number
what is a floating point?
a number with a decimal point
What are the maths symbols in python?
+ = addition
- = subtraction
* = multiplication
** = for exponentiation (squared e.g 2**3 = 8)
What does % and // also mean?
% = returns the remainder when one integer is divided by another (for example 19/5 = 3.8 but using a % would round it up to 4 automatically)
// = performs integer division getting rid of any remainders without rounding. (For example 19/5 = 3.8 but using // would display it as 3)
What is the round function and what does it do?
- round()
put round( then the result you want to round , the number of decimals you want)
for example:
result = 12.34343
round(result,2) - 12.34
What are boolean data type?
is a data type that one of two possible values
What are the relational and logical operators?
less than: <
greater than: >
less than or equal: <=
greater than equal: >=
equal: ==
not equal: !=
logical and: and
logical or: or
logical not: not
what are objects in python?
strings, integers and floating points
What are assignment statement?
names are assigned to objects
What should you be aware when naming variables?
- they are case-sensitive so AverageMark is different averageMark
- Don’t make the name too long
What does the print statement do?
Display text and data on the screen