This is a beginner-level Python script that takes two numbers from the user, adds them using a simple function, and prints the result.
It’s a great starting point to understand how functions, input, and basic operations work together in Python.
- Asks the user to enter two numbers
- Converts the inputs into float type (so decimals work too)
- Sends the numbers into a custom function called
add()
- Adds the numbers and returns the result
- Prints the final answer clearly
- Perfect for practicing function structure in Python
- Builds confidence in writing clean and simple code
- Can be expanded into a calculator later
- Python 3
- No extra libraries — just built-in functions
add_two_numbers.py
→ contains the complete working code
Hadia — Exploring Python through simple and useful scripts.