# Data types and Operators

Every value is stored as a particular data type. Some of the simple data types you need to know are:

- Integer
- Real
- String
- Boolean

The following video clip describes what these are.

## Examples

Examples of **strings** are: `"Hello"`

, `"Goodbye"`

.

- To input a string, use
`input()`

Examples of **integers** are: `2, 6, -89, 45421`

.

- To input an integer at the screen, use
`int(input())`

Examples of **reals** are: 2.4, 6.0, -89.54, 111.111.

- To input a real number at the screen, use
`float(input())`

A boolean variable always has the value `True`

or `False`

. Remember Python is case sensitive so the capital `T`

or `F`

really matters!

## Operators

The following operators are used in expressions in Python:

Operator | What it means | Example |
---|---|---|

`+` |
Add to | `4 + 5` |

`-` |
Subtract | `5 - 1` |

`*` |
Multiply | `7 * 3` |

`/` |
Divide | `7 / 4` |

`//` |
Whole number division | `20 // 3` |

`%` |
Remainder after whole number division | `20 % 3` |

`**` |
To the power of | `3 ** 4` |

`==` |
Equals | `5 == 4` |

`!=` |
Not equals to | `5 != 4` |

`>` |
Greater than | `5 > 4` |

`<` |
Less than | `5 < 4` |

`>=` |
Greater than or equal to | `5 >= 5` |

`<=` |
Less than or equal to | `4 <= 4` |

`&` |
Logical AND | `True & False` |

**Previous**- Introduction to Python**Next**- String Operation and Math Unit Exercises

- 1. Introduction to Python
- 2. Data types and Operators
- 3. String Operation and Math Unit Exercises
- 4. The IF Statement
- 5. More on IF
- 6. The Maze Game
- 7. Selection Exercises
- 8. FOR Loops
- 9. While Loops
- 10. Making a quiz
- 11. Iteration Exercises
- 12. Lists, Functions and Files
- 13. Creating a list
- 14. Lists with a FOR Loop
- 15. List operations
- 16. Consolidation
- 17. Lists Exercises
- 18. Functions
- 19. Parameters
- 20. Functions with parameters
- 21. Menu Program
- 22. Functions Exercises
- 23. Reading from a file
- 24. Reading from a file - Part 2
- 25. Writing to a file
- 26. Extending the Quiz