Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume we have 1 2 months ( m ) of price ( p ) and region 1 quantity ( q 1 ) and region 2

Assume we have 12 months (m) of price (p) and region 1 quantity (q1) and region 2 quantity (q2) data. Therefore, create the following "lists" in Python by entering the following code:
m =[1,2,3,4,5,6,7,8,9,10,11,12]
p =[1,1,2,3,5,8,13,21,34,55,89,93]
q1=[2,3,3,4,6,9,14,22,35,56,90,100]
q2=[6,8,12,14,16,19,24,32,35,56,90,120]
print('The months are: '+ str(m))
print('The prices are: '+ str(p))
print(The region 1 quantities are: + str(q1))
print('The region 2 quantities are: '+ str(q2))
Part 2
Apply the following computations:
Using the quantity 1 data (q1), perform total revenue computations for each month. Note that total revenue = price * quantity.
Store the results in a new list called "tr1." Hint: Create a new 12-item list called "tr1" and place 0s into each location. Then, perform the appropriate calculation for each month and place the result into the appropriate location in the "tr1" list.
Use a "print" statement to echo the following on the screen: The region 1 total revenues are: .
The procedure in the above steps can be more easily implemented using a "for" flow control statement.
Therefore, using a "for" flow control statement, perform total revenue computations for each month using the quantity 2 data (q2). Note that total revenue = price * quantity.
Store the results in a new list called "tr2." Hint: Create a new 12-item list called "tr2" and place 0s into each location.
Then, using the "for" flow control statement, perform the appropriate calculation for each month and place the result into the appropriate location in the "tr2" list.
Use a "print" statement to echo the following on the screen: The region 2 total revenues are: .

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions

Question

Discuss the key people management challenges that Dorian faced.

Answered: 1 week ago

Question

How fast should bidder managers move into the target?

Answered: 1 week ago