Tutorial 2

Data types and Arithmetic operations (Precedence rule)

Tutorial Description

Welcome to the Tutorial 2 on "Data types and Arithmetic operations (Precedence rule)". Here's a brief overview of what you can expect in this tutorial:

Introduction to Data Types in Python

Basic understanding of built-in Python data types

  • Text Type: str
  • Numeric Types: int, float, complex
  • Sequence Types: list, tuple, range
  • Mapping Type: dict
  • Set Types: set, frozenset
  • Boolean Type: bool
  • Binary Types: bytes, bytearray, memoryview
  • None Type: NoneType

Working with Data Types

  • Exploring the str data type.
  • Distinguishing between int and float.
  • A brief overview of sequences, mappings, and sets.
  • Understanding bool data type and its equivalence to numbers (True=1 and False=0).
  • Introduction to the None type.
  • A brief mention of Binary data types.

Arithmetic Operations and Operation Precedence

  • Learn about performing arithmetic operations on numbers and booleans.
  • A table showcasing the precedence of different operators:
    • Parentheses ()
    • Exponents **
    • Multiplication *, /, //, %
    • Addition +,-
    • Relational ==, !=, <=, >=, >, <
    • Logical operations not, and, or
  • Deep dive into the special operators: %, //, ==, !=, <=, >=
  • An example to highlight operation precedence in Python.

Type Conversions

  • Converting strings into numeric types and vice versa.

Tutorial Exercise

Practical exercise for you to implement and test your understanding of the concepts taught in this tutorial. This involves performing arithmetic operations using the learned data types and understanding the significance of operation precedence.

The tutorial notebook and exercise could be found at JupyterHub on shared-storage/tutorials/tutorial2/exercise