Skip to content

###Basic Calculator Program # Get input from the user num1 = float(input("Enter the first number: ")) num2 = float(input("Enter the second number: ")) operation = input("Enter the operation (+, -, *, /): ") # Perform the chosen operation and display the result if operation == '+': result = num1 + num2 print(f"{num1} + {num2} = {result}") elif operation == '-': result = num1 - num2 print(f"{num1} - {num2} = {result}") elif operation == '*': result = num1 * num2 print(f"{num1} * {num2} = {result}") elif operation == '/': if num2 != 0: result = num1 / num2 print(f"{num1} / {num2} = {result}") else: print("Error: Division by zero is not allowed.") else: print("Invalid operation. Please enter one of +, -, *, or /.") #35

Description

@Mohabz35
No description provided.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions