1 answer

11. Implement the following function in the PyDev module functions.py and test it from a PyDev...

Question:

11. Implement the following function in the PyDev module functions.py and test it from a PyDev module named t11.py: def find_

11. Implement the following function in the PyDev module functions.py and test it from a PyDev module named t11.py: def find_word_vertical(matrix, word): Look for word in each column of the given matrix of characters. Returns a list of indexes of all column that are equal to word. Returns an empty list if no column is equal to word. Use: cols - find_word_vertical(matrix, word) Parameters: matrix - the matrix of characters (2D list of str) word - the word to search for (str) Returns: cols - a list of column indexes (list of int) Sample testing: Strings: ["cdb", "aoi", "tgg"] Matrix of characters: 0 1 d с 0 1 2 2 b i g a O t g The word to search for: dog The word is found in columns [1]

Answers

Source Code:

def find_word_vertical(matrix,word):
   ret_lst=[]
   rows=len(matrix)
   cols=len(matrix[0])
   for i in range(0,rows):
       temp=""
       for j in range(0,cols):
           temp=temp+matrix[j][i]
       if(temp==word):
           ret_lst.append(i)
   return ret_lst

Strings=["cdb","aoi","tgg"]
matrix=[['c','d','b'],
       ['a','o','i'],
       ['t','g','g']]
print("Strings: ",Strings)
print("\nMatrix of characters:")
print(" ",end=" ")
for k in range(0,len(matrix[0])):
print(k,end=" ")
print()
for i in range(0,len(matrix)):
print(i,end=" ")
for j in range(0,len(matrix[0])):
print(matrix[i][j],end=" ")
print()
word=input("\nEnter the word to search for: ")
res=find_word_vertical(matrix,word)
print("The word is found in columns ",res)1 def find word vertical(matrix, word): 2 ret ist=[] 3 rows=len (matrix) 4 cols=len (matrix[0]) 5 for i in range(0, rows) : 6

Sample input and output:

Strings: [cdb, aoi, tgg] Matrix of characters: 0 1 2 ocdb 1 a oi 2 tgg Enter the word to search for: dog The word is fo

.

Similar Solved Questions

1 answer
A supplier provides parts to a manufacturing company that demands JIT deliveries. At the present time...
A supplier provides parts to a manufacturing company that demands JIT deliveries. At the present time it takes 6 hours to make a round-trip between the supplier's warehouse and the customer, including loading, travel and unloading time. The lot size is 12 pallet loads on a truck, and the manufac...
1 answer
Dooley, Inc., has outstanding $100 million bonds that pay an annual coupon rate of interest of...
Dooley, Inc., has outstanding $100 million bonds that pay an annual coupon rate of interest of 11 percent. Par value of each bond is $1,000. The bonds are scheduled to mature in 10 years. Because of Dooley’s increased risk, investors now require a 13 percent rate of return on bonds of similar ...
1 answer
Save Homework: Chapter 20 Homework Assignment Score: 0 of 1 pt 1 of 1 (0 complete)...
Save Homework: Chapter 20 Homework Assignment Score: 0 of 1 pt 1 of 1 (0 complete) P20-41A (similar to) HW Score: 0%, 0 of 1 pt Question Help The contribution margin income statement of Sweet Pea Donuts for August 2018 follows: (Click the icon to view the contribution margin income statement.) Sweet...
1 answer
Please check my answers. 1. Prepare Journal Entry to record income tax expense, deferred taxes, and...
Please check my answers. 1. Prepare Journal Entry to record income tax expense, deferred taxes, and income taxes payable for 2018 2. Draft the income tax expense section of the Income Statement, beginning with Income before income taxes". . Write an analysis directed toward the team at Good Co...
1 answer
1 a). Give a counter example to the proposition: Every positive integer which ends in 31...
1 a). Give a counter example to the proposition: Every positive integer which ends in 31 is a prime. b). Give a proof by cases that min{s, t} + max{s, t} = s + t for any real numbers s and t. Hint: One of the cases you might use is s ≤ t or s < t. Depending on your choice, what would be the ot...
1 answer
20:01 V.VB/s STC Exam-2.pdf Subject: Mechanics of Materials Code: CE 202 Semester 411 QUESTION #2 Beam...
20:01 V.VB/s STC Exam-2.pdf Subject: Mechanics of Materials Code: CE 202 Semester 411 QUESTION #2 Beam AE is loaded as shown in the Figure. a) Draw the shear force and the bending moment diagrams for the beam. Clearly mark the numerical values at points A, B, C, D and E. b) What are the maximum bend...
1 answer
1. Should a hospital be able to raise whatever interest the state itself may have in...
1. Should a hospital be able to raise whatever interest the state itself may have in seeking to compel an unwilling patient to undergo a routine, lifesaving medical procedure? Explain. 2. Describe why a patient's responsibilities are as important as his or her rights....
2 answers
Suppose Bill is on a low-carbohydrate diet. He can eat only three foods:
Suppose Bill is on a low-carbohydrate diet. He can eat only three foods: Rice Krispies, cottage cheese, and popcorn. The marginal utilities for each food are tabulatedbelow. Bill is allowed only 167 grams of carbohydrates daily. Rice Krispies, cottage cheese, and popcorn provide 25, 6, and 10 grams ...
1 answer
Selected account balances from the adjusted trial balance for Olinda Corporation as of Its calendar year-end...
Selected account balances from the adjusted trial balance for Olinda Corporation as of Its calendar year-end December 31 follow. Debit Credit Interest revenue 15,500 $ 35,500 b. Depreciation expense-Equipment Loss on sale of equipment d. Accounts payable Other operating expenses £. Accumulated...
1 answer
Analyze new fiscal policy actions undertaken by the U.S. government throughout 2000 - 2010 by describing...
Analyze new fiscal policy actions undertaken by the U.S. government throughout 2000 - 2010 by describing their intended effects, using macroeconomic principles to explain the actions. This rubric element wants you to examine what the fiscal policy initiatives were going forward, to respond to the ch...
1 answer
Two identical capacitors store different amounts of energy: capacitor A stores 3.5 10-3 J, and capacitor...
Two identical capacitors store different amounts of energy: capacitor A stores 3.5 10-3 J, and capacitor B stores 4.6 10-4 J. The voltage across the plates of capacitor B is 13 V. Find the voltage across the plates of capacitor A....
1 answer
Consider equally risky, all-equity financed firms G and D. Both firms are currently trading at $50...
Consider equally risky, all-equity financed firms G and D. Both firms are currently trading at $50 per share. Firm G pays no dividends, but firm D pays all its earnings as dividends. In a year from today, the stock of firm G is expected to be at $65 per share. Firm D is expected to pay a $15 dividen...
1 answer
The solution of the equation [ax? +(6+1)y?]dx– xydy=0, where a and b are constant is Select...
The solution of the equation [ax? +(6+1)y?]dx– xydy=0, where a and b are constant is Select one: O a. ax” +by? =C b. nlatok 3) = 2 = 2bln(x) o cby? = x26+2 O d. ax? +by? = cx20 +2 e (a+b)x?+by? = x22 o fax +(6+1)/2 = c x2 +2 og Inax? +by?)=2bin(x)+c = -2bln(x)+c...
1 answer
(4 marks) Suppose that a program does read operations on the following memory addresses (e.g., with...
(4 marks) Suppose that a program does read operations on the following memory addresses (e.g., with “lb” or “lw” instructions): 248, 1312. Give the number of the memory block that each of these addresses belongs to, for each of the following memory block sizes. (a) block size...
1 answer
** Not Multiple Choice Section ** 11. [25 points] Consider the planetary gear train shown in...
** Not Multiple Choice Section ** 11. [25 points] Consider the planetary gear train shown in the figure. * Gear E is the driver running at +100 rpm. The Arm (link A) is the output driven link. The ring gear B is fixed. The number of teeth given as: are NE 34 ND 17 Nc 26 a) Determine the number of te...
1 answer
How do you simplify #(x^6y^7)/(y^2)#?
How do you simplify #(x^6y^7)/(y^2)#?...
1 answer
Kingbird, Inc. has 10,600 shares of 9%, $100 par value, cumulative preferred stock outstanding at December...
Kingbird, Inc. has 10,600 shares of 9%, $100 par value, cumulative preferred stock outstanding at December 31, 2022. No dividends were declared in 2020 or 2021. If Kingbird wants to pay $420,000 of dividends in 2022, what amount of dividends will common stockholders receive? Dividends allocated to c...
1 answer
What is the equation of sinusoidal function with the amplitude 3 and period pi/4?
What is the equation of sinusoidal function with the amplitude 3 and period pi/4?...