id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

peter@norvig.com pemdas > pemdas_operator
prev  |  next  |  chance

This exercise does the EMDAS part of PEMDAS. That is, it gives you a function, pemdas_operator(ops, items), that will allow you to do the EMDAS part. Consider the MD part. The idea is that in "3+4*5", we do MD (multiplication and division) before AS (addition and subtraction). This transforms "3+4*5" into "3+(4*5)". In our notation, using a list of items, pemdas_operator(['*', '/'], [3, '+', 4, '*', 5]) should return [3, '+', [4, '*', 5]].


...Save, Compile, Run (ctrl-enter)

def pemdas_operator(ops, items):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 534 Post-solution available

Copyright Nick Parlante 2017 - privacy