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

  • SEARCH
  • Home
  • 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 8631447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:13:13+00:00 2026-06-12T09:13:13+00:00

My task is to code some functions to evaluate postfix, prefix and infix expressions.

  • 0

My task is to code some functions to evaluate postfix, prefix and infix expressions. This is fine and dandy, and I’ve finished that portion of the task, however my problem arises when I take in the expression. If the user inputs a string lead by ‘V’, I have to assign the integers that come after ‘V’ to as many variables as needed. To try and be more clear, if the input was ‘V 1 2 4 9’, I would have to assign 1 to the letter A, 2 to the letter B, 4 to the letter C, and 9 to the letter D. I can do this if I assign each, variable by variable. But that is a long and arduous process, and I’m sure there’s a better way to do it. The reason I need to assign the integer values to variables is because when the user wants to evaluate an expression, it has to be in the form ‘-+AB*CF’, for example, if it was a prefix notation expression. Of course the form changes if the users wants infix or postfix, but the values to be evaluated are still in alphabet form, much like mathematics I guess.

My apologies if this question in unclear. Obviously this is homework, however I don’t need code or people to do it for me, just some clarification about the best method would more than suffice. Thanks all.

  • 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-12T09:13:14+00:00Added an answer on June 12, 2026 at 9:13 am

    Store the values in a dictionary instead:

    import string
    
    keys = string.ascii_uppercase
    values = # make list of the values
    
    variables = {keys[i]: val for i, val in enumerate(values)}
    

    Now you can address the values in V 1 3 4 as variables['A'], variables['B'], etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Task at hand — I have three versions of some code, developed by different
I got a task to maintain a c# project, I found some code like
I am experimenting with this code: foreach (var r in _vm.Rules.Take(20)) { Task.Factory.StartNew(() =>
I'm writing an application that do some task and inform user upon successful completion
This task has already been asked/answered, but I recently had a job interview that
I have a custom c++ module for python that exposes functions, some of which
I am assigned with the task of verifying some verilog based RTL code. Now,
i have the following code to disable task manager of windows xp but it
I have below code: class Program { static void Main(string[] args) { Task[] tasks
This is my Python code - cursor.execute(UPDATE tasks SET task_owner=%s,task_remaining_hours=%s, task_impediments=%s,task_notes=%s WHERE task_id=%s, (new_task_owner,new_task_remaining_hours,new_task_impediments,

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.