1 answer

IN PYTHON Develop the program that will allow you to obtain an ordered list of whole...

Question:

IN PYTHON  Develop the program that will allow you to obtain an ordered list of whole numbers from least to greatest from two lists of whole numbers. The individual values ​​of the input lists are captured by the user one by one and then both lists will be joined and then sorted in ascending order (from lowest to highest value). Your program should allow the capture of the entire values ​​of the lists without making use of messages (legends) to the user and will show the result in the form indicated below
To order:  You cannot use the sort or sorted function or any function already ordered. You will have to write it yourself. If you use any of these functions you will not have extra points.  I recommend you make a function called order (list) that receives a list and returns an ordered list.  The algorithm to sort would be more or less like this:
For each item in the list, one pass to the list will be made On each pass, the element i will be checked with the i + 1 and if the element in i is larger than the element that is in i + 1, exchange them, continue checking until one before the end (so that in i + 1 you don't an index out of range comes out, in this way, the larger number will be 'pushed' to the end and it is not necessary to revise that element (your range may decrease each pass). If there were no exchanges, it means that everything is already in order and it is not necessary to make more passes (you can use a Boolean variable to know if you made an exchange or not)

example:

3 1 4 5 * 2 9 6 1 3 *

OUTPUT

L1 = [3, 1, 4, 5] L2 = [2, 9, 6, 1, 3] LORDENADA = [1, 1, 2, 3, 3, 4, 5, 6, 9]

Example 2

*
*

output

L1 = [] L2 = [] LORDENADA = []

Answers

i def sortlist(a): # function to sort a list for i in range (len(a)): for j in range(len(a)-1): if a[j] > a[j+1]: alj), a[j+1

WOON * L1 = [3, 1, 4, 5] L2 = [2, 9, 6, 1, 3] LORDENADA = (1, 1, 2, 3, 3, 4, 5, 6, 9]

def sortList(a): # function to sort a list

for i in range(len(a)):

for j in range(len(a)-1):

if a[j] > a[j+1]:

a[j], a[j+1] = a[j+1], a[j]

return a

L1 = []

L2 = []

one = input() # user input of first list

while one != "*":

L1.append(int(one))

one = input()

one = input() # user input of second list

while one != "*":

L2.append(int(one))

one = input()

print("L1 =", L1) # printing two lists

print("L2 =", L2)

L1 = sortList(L1) # sorting two lists

L2 = sortList(L2)

LORDENADA = sortList(L1 + L2) # sorting merged list

print("LORDENADA =",LORDENADA) # printing output

# Please up vote. Happy Learning!

.

Similar Solved Questions

2 answers
How many terms of the arithmetic sequence 2, 4, 6, 8,
How many terms of the arithmetic sequence 2, 4, 6, 8, ... add up to 60,762? Can anyone help me with the answer and how you solved for it? I am confused and have gotten several different answers trying to do this problem. Thank you...
1 answer
Degree of Operating Leverage, Percent Change in Profit Ringsmith Company is considering two different processes to...
Degree of Operating Leverage, Percent Change in Profit Ringsmith Company is considering two different processes to make its product-process 1 and process 2. Process 1 requires Ringsmith to manufacture subcomponents of the product in-house. As a result, materials are less expensive, but fixed overhea...
1 answer
How do you find #f(2)# given #f(x)=9x^3-x^2+2#?
How do you find #f(2)# given #f(x)=9x^3-x^2+2#?...
1 answer
The adjusted trial balance of Cullumber Company shows these data pertaining to sales at the end...
The adjusted trial balance of Cullumber Company shows these data pertaining to sales at the end of its fiscal year, October 31, 2022: Sales Revenue $901,000; Freight-Out $12,100; Sales Returns and Allowances $18,100; and Sales Discounts $13,600. Prepare the sales section of the income statement....
1 answer
(1 point) Find the solution of y" – 4y + 4y = 16 % with y(0)...
(1 point) Find the solution of y" – 4y + 4y = 16 % with y(0) = 1 and y (0) = 3. y =...
1 answer
The following information is given for ether, C2H30C2H5, at 1 atm: boiling point = 34.6 °C...
The following information is given for ether, C2H30C2H5, at 1 atm: boiling point = 34.6 °C AH ap(34.6 °C) = 26.5 kJ/mol melting point =-116 °C AH fus(-116 °C) = 7.27 kJ/mol specific heat liquid = 2.32 J/gºC At a pressure of 1 atm, kJ of heat are needed to vaporize a 35.6 g sampl...
1 answer
Write the statement in symbols using the p and q given below
Write the statement in symbols using the p and q given below. Then construct a truth table for the symbolic statement and select the best match.p = At most, 100 guests arrived at the wedding reception.q = There was a lot of cake left over.It is not the case that, at most, 100 guests arrived at the w...
1 answer
When a 160z. bottle of Mountain Dew costs $1.00, Billy Ray will buy 1 bottle and...
When a 160z. bottle of Mountain Dew costs $1.00, Billy Ray will buy 1 bottle and 3 Slim Jims. When the price of a 16oz. bottle of Mountain Dew increases to $1.39, he will buy 1 bottle and 2 Slim Jims. What is the cross-price elasticity of demand for Slim Jims with respect to Mountain Dew?...
1 answer
1. You’re working as an accountant at a CPA firm currently. You’re trying to figure out...
1. You’re working as an accountant at a CPA firm currently. You’re trying to figure out if you should start your own practice. Your current income is $75,000 a year. The cost of rent for an office space is $18,000 a year. Other overhead costs are about $15,000 a year. What is the opportu...
1 answer
Organophosphates (OPs) are toxic chemicals contained in many pesticides used heavily in agriculture. They can have...
Organophosphates (OPs) are toxic chemicals contained in many pesticides used heavily in agriculture. They can have severe, acute effects, including death, beginning within minutes to hours of exposure. Other symptoms can develop over longer time periods. Exposure can occur through inhalation, ingest...
1 answer
Exercise 8-05 The ledger of Shamrock, Inc. at the end of the current year shows Accounts...
Exercise 8-05 The ledger of Shamrock, Inc. at the end of the current year shows Accounts Receivable 589,000; Credit Sales $845,000; and Sales Returns and Allowances $38,000. (a) If Shamrock uses the direct write-off method to account for uncollectible accounts, journalize the adjusting entry at Dece...
1 answer
1. Work: u x2 +12=2y 24-12 12. 4x2-26-218x) 4x +4 168 1718 4x7-16xilo Vibe lac the...
1. Work: u x2 +12=2y 24-12 12. 4x2-26-218x) 4x +4 168 1718 4x7-16xilo Vibe lac the FIGL 4 (0)18) 11 4.2.16 49-4 16 (x,y)=...
1 answer
The Shirt Works sells a large variety of tee shirts and sweatshirts. Steve Hooper, the owner,...
The Shirt Works sells a large variety of tee shirts and sweatshirts. Steve Hooper, the owner, is thinking of expanding his sales by hiring high school students, on a commission basis, to sell sweatshirts bearing the name and mascot of the local high school. These sweatshirts would have to be ordered...
1 answer
If #3-x^2=tany#, then what is #dy/dx#?
If #3-x^2=tany#, then what is #dy/dx#?...
1 answer
Prepare a 400 mL of 1M sodium acetate buffer at pH 6.5. Show work & explain
Prepare a 400 mL of 1M sodium acetate buffer at pH 6.5. Show work & explain...
1 answer
Sweet Inc., a greeting card company, had the following statements prepared as of December 31, 2017....
Sweet Inc., a greeting card company, had the following statements prepared as of December 31, 2017. SWEET INC. COMPARATIVE BALANCE SHEET AS OF DECEMBER 31, 2017 AND 2016 12/31/17 12/31/16 $6,900 $6,000 Cash Accounts receivable 62,500 50,900 Short-term debt investments (available-for-sale) 35,200 17,...
1 answer
On August 1, 2018, Limbaugh Communications issued $35 million of 10% nonconvertible bonds at 102. The...
On August 1, 2018, Limbaugh Communications issued $35 million of 10% nonconvertible bonds at 102. The bonds are due on July 31, 2038. Each $1000 bond was issued with 20 detachable stock warrants, each of which entitled the bondholder to purchase, for $60. one share of Limbaugh Communications no par ...
1 answer
Gwyneth Inc. currently has a contribution margin of $ 22 on its only product and sells...
Gwyneth Inc. currently has a contribution margin of $ 22 on its only product and sells 42,000 units. Gwyneth Inc. is considering cutting its sales price by $ 3 to generate an increase in sales of 12,000 units. How will this change affect its operating​ income?   A.It will decrease op...