Skip to content

pesh911/Python-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Python-calculator

Ask the user for two numbers and an operation

num1 = float(input("Enter the first number: ")) num2 = float(input("Enter the second number: ")) operation = input("Enter the operation (+, -, *, /): ")

Perform the selected operation

if operation == "+": result = num1 + num2 elif operation == "-": result = num1 - num2 elif operation == "*": result = num1 * num2 elif operation == "/": if num2 != 0: result = num1 / num2 else: result = "Error: Division by zero is not allowed." else: result = "Invalid operation."

Display the result

print(f"The result is: {result}")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published