Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8786971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:46:04+00:00 2026-06-13T21:46:04+00:00

I am creating a calculator program and I am nearly complete. The last problem

  • 0

I am creating a calculator program and I am nearly complete. The last problem I am encountering is dealing with a second operator.

The program takes an expression with a maximum of two operators(ex.2/3*4). It splits it into 2,/,3,*,4 and the uses many varying functions to solve the expression. Now the specific part I am presenting below is the function that solves the first expression, (I have solved the rest of it already):

def firstOperationWithOneOperator(numEx1,numEx2,opEx1):

    if opEx1=="*":
        solution1=numEx1*numEx2
        print(solution1)
        return solution1
    elif opEx1=="/":
        solution1=numEx1/numEx2
        print(solution1)
        return solution1
    elif opEx1=="+":
        solution1=numEx1+numEx2
        print(solution1)
        return solution1
    elif opEx1=="-":
        solution1=numEx1-numEx2
        print(solution1)
        return solution1

So I now have a working function to solve something with one operator(ex.2/3) as you can see above. I needed some help finding out how to deal with a second operator while keeping the order of operations in check. So how can I solve an expression such as 2+3*5? I will keep updating my OP with limitations as they are presented, if any. If anything is unclear please ask and I will edit the OP.

EDIT:

def fowoo(nums1,fowoo(nums2,nums3,ops2),ops1):
    print(fOWOO(nums1, fOWOO(nums2, nums3, ops2), ops1))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:46:05+00:00Added an answer on June 13, 2026 at 9:46 pm
    fOWOO = firstOperationWithOneOperator
    

    You need to decide between:

    fOWOO(num1, fOWOO(num2, num3, op2), op1)  # num1 `op1` (num2 `op2` num3)
    

    and

    fOWOO(fOWOO(num1, num2, op1), num3, op2)  # (num1 `op1` num2) `op2` num3
    

    Based on the precedence of op1 and op2


    So:

    • 2 / 3 + 4 -> fOWOO(fOWOO(2, 3, '/'), 4, '+')
    • 2 + 3 / 4 -> fOWOO(2, fOWOO(3, 4, '/'), '+')
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a program that takes some time creating pdf files i would like
I'm trying to learn Objective-C and my program (creating a calculator) gets linker or
I am creating a mortgage calculator android program and I was trying to figure
I am creating a VB 2008 change calculator as an assignment. The program is
I am creating a calculator application for all types of mathematical algorithms. However, I
I am creating a graphing calculator in Java as a project for my programming
I am creating a poker system and I am currently streamlining my hand calculator.
I am creating a website, where I will sell computer and calculator programs. When
I have little program creating a maze. It uses lots of collections (the default
I am creating a pricing program. I need to calculate the amounts according to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.