Back

Data types

Q1. Describe what is meant by a floating point number.
Q2. Give five examples of an integer to clearly show that you know what one is.
Q3. What is meant by a string?


Q4. What two values can a Boolean data type hold? 
Q5. What data type is true?
Q6. There are five pre-defined data types in Python. These are float, str, int and bool. Find out what the fifth one is and give an example of it (Note: you don't really need to know about this data type unless you are doing A Level Maths!)
Q7. Can you define your own data type in Python, with its own allowable values?
Q8. What Python keyword can be used to find out the data type of a particular piece of data?
Q9. Type in this code into the Python shell.

fantastic = 10
type(fantastic)

What class of data type does fantastic belong to?
Q10. Predict what class of data type each of the pieces of data in the following table are. When you have made your predictions, use type and the Python shell to see if you are correct. Type in to the Python shell exactly what you see in the data column!

Data Data type
4.0  
3454  
true  
"friend"  
False  
-5+4j  
0.000  
-3  
-3.0  
'recipe'  
table  
True  
"Pi"  
 -3.5+2i  

 Back