# dhyanesh08/python-calculator architecture

> Architecture diagram of the GitHub repository dhyanesh08/python-calculator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dhyanesh08/python-calculator
- Repository: https://github.com/dhyanesh08/python-calculator

## Overview

This is a small interactive command-line calculator. A user repeatedly selects an operation, enters numeric input, and sees a result; binary and unary operations are supported, including trigonometry and logarithms. All behavior lives in `calculator.py`: it validates input, dispatches through operation dictionaries, and prints results. The README lists the same capabilities. No separate storage or service layer exists.

Main entry points: [`calculator.py`](https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py) (Interactive loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Calculator CLI"]
  node_main["Interactive loop<br/>[calculator.py]"]
  node_input["Number input<br/>[calculator.py]"]
  node_dispatch["Operation dispatch<br/>[calculator.py]"]
  node_result["Printed result<br/>[calculator.py]"]
end

subgraph group_math["Math Operations"]
  node_binary["Binary operations<br/>[calculator.py]"]
  node_unary["Unary operations<br/>[calculator.py]"]
end

node_user(("User"))
node_mathlib["Python math"]

node_user -->|"enters choices"| node_main
node_main -->|"requests numbers"| node_input
node_input -->|"returns values"| node_main
node_main -->|"selects operation"| node_dispatch
node_dispatch -->|"calls binary"| node_binary
node_dispatch -->|"calls unary"| node_unary
node_unary -->|"uses trig/log"| node_mathlib
node_binary -->|"returns value"| node_result
node_unary -->|"returns value"| node_result
node_result -->|"prints result"| node_user

click node_main "https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py"
click node_input "https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py"
click node_dispatch "https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py"
click node_binary "https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py"
click node_unary "https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py"
click node_result "https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_input,node_dispatch,node_result,node_user toneBlue
class node_binary,node_unary toneAmber
class node_mathlib toneIndigo
```

## Components

### Calculator CLI

- [Interactive loop](https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py): `calculator.py`
- [Number input](https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py): `calculator.py`
- [Operation dispatch](https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py): `calculator.py`
- [Printed result](https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py): `calculator.py`

### Math Operations

- [Binary operations](https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py): `calculator.py`
- [Unary operations](https://github.com/dhyanesh08/python-calculator/blob/main/calculator.py): `calculator.py`

### Other components

- **User**
- **Python math**

## Connections

- User → Interactive loop: enters choices
- Interactive loop → Number input: requests numbers
- Number input → Interactive loop: returns values
- Interactive loop → Operation dispatch: selects operation
- Operation dispatch → Binary operations: calls binary
- Operation dispatch → Unary operations: calls unary
- Unary operations → Python math: uses trig/log
- Binary operations → Printed result: returns value
- Unary operations → Printed result: returns value
- Printed result → User: prints result
