Python Command-Line Calculator Project

🐍 First Python project done! I built a command-line calculator that takes two numbers and an operator as input and returns the result. Clean, simple, functional. Here's what I learned from this tiny project: 👉 How if/elif/else logic works in Python 👉 Type conversion with float() 👉 Taking user input with input() 👉 Edge case handling (invalid operators) 👉 Here is My Projcet num1 = float(input("Enter first number:")) operator = input("Enter operator (+, -, *, /):") num2 = float(input("Enter second number:")) if operator == "+": result = num1 + num2 elif operator == "-": result = num1 - num2 elif operator == "*": result = num1 * num2 elif operator == "/": result = num1 / num2 else: result = "Invalid operator" print("Result:", result) The best way to learn programming? Build something, no matter how small. What was YOUR first ever coding project? Drop it in the comments! 👇 #Python #Programming #SoftwareDevelopment #LearningToCode #TechCommunity

To view or add a comment, sign in

Explore content categories