Arithmetic Arranger Problems:
Do the problems need to be the same as the ones in the example?
Do the problems need to be in quotation marks?
Is there a special format for the Arithmetic Arranger Function?
Thanks!
Your code so far
Still A Work In Progress…
operator.sub(a, b)
operator.sub(a, b)
Return a - b.
print(arithmetic_arranger([“32 + 698”, “3801 - 2”, “45 + 43”, “123 + 49”]))
arithmetic_arranger([“32 + 698”, “3801 - 2”, “45 + 43”, “123 + 49”])
Content - [“32 + 698”, “3801 - 2”, “45 + 43”, “123 + 49”]
Arithmetic - “32 + 698”, “3801 - 2”, “45 + 43”, “123 + 49”
boilerplate-arithmetic-formatter-5 - Replit
a = input ("Equation 1: ") # String Operation (Addition or Subtraction)
b = input ("Equation 2: ") # String Operation (Addition or Subtraction)
c = input ("Equation 3: ") # String Operation (Addition or Subtraction)
d = input ("Equation 4: ") # String Operation (Addition or Subtraction)
e = input ("Equation 5: ") # String Operation (Addition or Subtraction)
fa = float(a) # Float Operation (Addition or Subtraction)
fb = float(b) # Float Operation (Addition or Subtraction)
fc = float(c) # Float Operation (Addition or Subtraction)
fd = float(d) # Float Operation (Addition or Subtraction)
fe = float(e) # Float Operation (Addition or Subtraction)
def ArithmeticArranger([a, b, c, d, e,]):
def ArithmeticArranger(a):
# def a = a list or string or equations ~ [a, b, c, d, e,]):
if a = ["32 + 698", "3801 - 2", "45 + 43", "123 + 49"]
a = raw_input())
b = raw_input())
else:
print()
# Error Messages:
# Error: Too many problems. (Can't be more than 5)
# Error: Operator must be '+' or '-'.
# Error: Numbers cannot be more than four digits.
#
if
else
try
except
if a = True
print()
Define Equations
Define Operations
def subtraction (a,b):
sub = a - b
return sub
print(sub)
def addition (a, b) :
add = a + b
return add
print(add)
def multiplication (a, b) :
multi = a * b
return multi
print(add)
def division (a, b) :
divi = a / b
return divi
print(divi)
def computerarithmetic():
subtraction(8,4)
print(arithmetic_arranger([“32 + 698”, “3801 - 2”, “45 + 43”, “123 + 49”]))
def ComputeArthmetic() :
print ("In ComputeArthmetic", a, b)
if a > 40 :
reg = rate * hours
otp = (rate * 0.5) * (hours - 40)
pay = reg + otp
return pay # The Missing Link!!
else:
pay = rate * hours
print("Returning", pay)
return pay
if a > 5 :
print('Error: Too many problems.')
if a = * or / :
print('Error: Operator must be '+' or '-'. `)
If == True :
print(Answers)
if a = True:
print(“”)
if a = False:
print(“”)
<class ‘bool’>
b = False
type(b)
<class ‘bool’>
a = input ("Enter Element 1: ") #String Hours
b = input ("Enter Variable 2: ") #String Rate
_ = input (“Operation 1” # String Operation (Addition or Subtraction)
fh = float(a) # Float Hours
fr = float(b) # Float Rate
xp = computepay(fh,fr)
print(“Pay:” ,xp)
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
Challenge: Arithmetic Formatter
Link to the challenge: