2.2.2 Data types Flashcards
What is casting? [1]
Converting one data type to another [1]
What is the python command to cast to a string? [1]
str() [1]
What is the python command to cast to an integer? [1]
int() [1]
What is the Python command to cast an ASCII number to its matching character? [1]
chr() [1]
What is the Python command to cast a character to it’s matching ASCII number? [1]
ord() [1]
What is an integer?
A whole number e.g. 2
What is a character
A single letter, number or symbol e.g. A
What is a string
A sequence of characters, e.g. Hello
What is a real number
A number with a decimal e.g. 2.2
What are real numbers also known as?
floats / floating point numbers
What is a Boolean
True or False
What data type would be best suited to store a phone number?
String - if you use int you’ll lost the 0 at the start.
What data type would be best suited to store the time in a 100m race?
Real number - you need the detail from the decimal