Here is a Python program. count = 0 number 0 myfile = open(text.txt, r) for line...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Here is a Python program. count = 0 number 0 myfile = open("text.txt", "r") for line in myfile: line line.rstrip() line line.split() if not count: number = len(line) count count + 1 if len(line) > number: continue number len(line) myfile.close() The split() function separates a line of text into a list of strings separated by spaces. You can assume the text file, text.txt, contains multiple lines of text. Each line of text is multiple English words separated by a single space. ο ο ο Which one of the following sentences is true about the program? The count variable contains the number of lines in the text file when the loop finishes running The number variable contains the minimum number of words on a line among all the lines in the text file The number variable contains the number of letters in the last line of the text file The number variable contains the number of letters in the first line of the text file Here is a Python program. count = 0 number 0 myfile = open("text.txt", "r") for line in myfile: line line.rstrip() line line.split() if not count: number = len(line) count count + 1 if len(line) > number: continue number len(line) myfile.close() The split() function separates a line of text into a list of strings separated by spaces. You can assume the text file, text.txt, contains multiple lines of text. Each line of text is multiple English words separated by a single space. ο ο ο Which one of the following sentences is true about the program? The count variable contains the number of lines in the text file when the loop finishes running The number variable contains the minimum number of words on a line among all the lines in the text file The number variable contains the number of letters in the last line of the text file The number variable contains the number of letters in the first line of the text file
Expert Answer:
Answer rating: 100% (QA)
The detailed answer for the above question is provided below initialize count and number to 0 count ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these electrical engineering questions
-
Which one of the following sentences has a faulty or vague pronoun reference? Selected Answer: Answers: Our sales associates greet customers in a friendly manner because this extra effort makes...
-
Here you will explore the relationship among three lines that pass through the origin (0, 0), where the slope of one of the lines is the reciprocal of the slope of one of the other lines. a. By hand,...
-
For the first four letters in the English alphabet, a. List the possible permutations of three letters from the four. b. List the possible combinations of three letters from the four. c. Use parts...
-
An increase in the supply of U.S. dollars by the Federal Reserve will raise the value of the dollar because it will stimulate U.S. economic growth raise the value of the dollar because it will lead...
-
Who has a greater opportunity cost of enjoying leisurea janitor or a brain surgeon? Explain. Can this help explain why doctors work such long hours?
-
Which of the following is not a valid SELECT statement? a. SELECT STDDEV (retail) FROM books; b. SELECT AVG (SUM (retail)) FROM orders NATURAL JOIN orderitems NATURAL JOIN books GROUP BY customer#;...
-
What is a writ of execution?
-
You are going to receive $205,000 in 18 years. What is the difference in present value between using a discount rate of 12 percent versus 9 percent?
-
Due to financial difficulties resulting from unfortunate business decisions, Mr. Bo Godina has been forced to sell a number of items. An A. Y. Jackson oil painting which he purchased for $140,000 is...
-
We want to design a tension spring with a spring outer diameter of 32 mm. The range of tensile load is 110 160 N, and the deformation range is 140~ 170 mm. We are going to use SWO-B as the material....
-
Identify what types of excavation are being performed and what equipment is being used. Is general excavation and grading work being performed? Are they using scrapers, dozers, front end loaders,...
-
Determine the attached wide I-bar HE100Bpermissible torque Tsall when permittedshear stress ?sall = 115 MPa. What isthen permissible distortion ?allowable (?/m)G = 80 GPa 100 mm 100
-
In 1965, the United States was at war with North Vietnam. Many people protested against it. Inspired, several students in Des Moines, Iowa planned a protest. They decided to wear black armbands with...
-
Write a javascript program to display the grade of a student 1) Text 1-Student Name 2) Text 2-Student Id 3) Text 3 - Mark 4) Button - When you click the button display the grade in Paragraph (apply...
-
Your customer Gods Blessing Enterprise Ltd is negotiating with Joe Bloggs Ltd of UK for the supply of Cars to Lectures and Medical Doctors valued at 150,000,000. The terms of payment are 60 days...
-
Given the frequency distribution for the data, Age Frequency Relative Frequency Cumulative Relative Frequency [20,29] 0.0333 [30,39] 0.3 0.3667 [40,49] [50,59] 0.5334 [60,69] 0.8001 [70,79] 0.9668...
-
The NY times in it's recent report on the sale of Starwood hotels reported. "we do not believe Marriott is willing to incur earnings dilution to facilitate the transaction". Analysts at wells Fargo...
-
6 (a) Briefly develop a mathematical model of the behaviour of a copper-twisted pair cable (b) Derive the magnetic energy from: w given that: K + w, where the - - k symbols have their usual meaning...
-
Phil and Linda are 25-year-old newlyweds and file a joint tax return. Linda is covered by a retirement plan at work, but Phil is not. a. Assuming Phil's wages were $27,000 and Linda's wages were...
-
Olive Corporation was formed and began operations on January 1, 2012. The corporation's income statement for the year and the balance sheet at year-end are presented below. The corporation made...
-
Jason and Mary Wells, friends of yours, were married on December 30, 2012. They know you are studying taxes and have come to you with a question concerning their filing status. Jason and Mary would...
-
State the main audit objectives for (1) sales transactions and (2) debtors balances.
-
What are the major files and printed outputs of computerised processing for sales transactions?
-
What is the sequence of steps normally associated with processing of credit sales? For each step, identify one control.
Study smarter with the SolutionInn App