---
title: mixedTypeArithmetic
tags:
  - python
  - math
  - float
  - int
  - type-coercion
aliases:
  - mixed type math
  - int float math
  - arithmetic between types
---

> [!note] Arithmetic Between Types  
> Python allows arithmetic between `int` and `float`:
> - `int` is automatically **converted to float** when mixed  
> - `/` always returns a `float`, even if both operands are `int`  
> - `//` performs floor division (returns `int` or `float`)  
> - `%` gives the remainder of division  
> 
> > [!example] Mixed Arithmetic Examples  
> > ```python
> > 3 + 4.0       # 7.0
> > 6 / 2         # 3.0
> > 7 // 4        # 1
> > 7 % 4         # 3
> > 12.75 % 3     # 0.75
> > ```
> 
> > [!info] Related Notes  
> > [[numericTypes]]  
> > [[arithmeticOperators]]  
> > [[typeConversions]]  
> > [[pythonSyntaxOverview]]  
