Question: Write a Python program called revenue.py to compute and display the revenue r given by the following expression: r = ax^2 + bx + c

Write a Python program called revenue.py to compute and display the revenue r given by the following expression: r = ax^2 + bx + c The input to the program must be a string such as a = 0.7, b=2, c =1200, x =1000 which specifies that the values of a, b, c, and x are 0.7, 2, 1200 and 1000 respectively. Note the following: The format of the input string is a comma separated list of name-value pairs with an equal sign between each name (i.e. a, b, c or x) and their corresponding values. The program must work correctly irrespective of the number of blank spaces that may precede or follow the equal signs or the commas. The expected input/output behavior of the program is illustrated below for three examples inputs: Enter Input String: a = -0.5, b =2, c =1100, x =40 r = 380.0 Enter Input String: a = 1, b=3, c=500, x = 50 r = 3150.0 Enter Input String: a = 0.7, b = 2, c = 1200, x =1000 r = 703200.0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!