Write a function countUpper () that takes a string representing a file name as a parameter....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a function countUpper () that takes a string representing a file name as a parameter. The program should read the content of the file and return the number of words where the first character is an upper-case letter. Hint: there is a built-in function that will check if a string is upper-case. The following shows how the function would behave for several sample files that are included in the zip file with the assignment template: >>> C = countUpper("hope.txt") >>> C 16 >>> countUpper("poppins.txt") 57 countUpper("none.txt") >>> 0 >>> Write a function countUpper () that takes a string representing a file name as a parameter. The program should read the content of the file and return the number of words where the first character is an upper-case letter. Hint: there is a built-in function that will check if a string is upper-case. The following shows how the function would behave for several sample files that are included in the zip file with the assignment template: >>> C = countUpper("hope.txt") >>> C 16 >>> countUpper("poppins.txt") 57 countUpper("none.txt") >>> 0 >>>
Expert Answer:
Answer rating: 100% (QA)
The image youve provided shows instructions for writing a Python function called countUpper This fun... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Evaluate sin 2 cos 2z enia z v dat x e =
-
Determine whether the given matrix is in row echelon form. If it is, state whether it is also in reduced row echelon form. determine whether the given matrix is in row echelon form. If it is, state...
-
Is there an angle such that sin(0) = 0 and tan (0) <0? Give an example if one exists, or explain why no such example is possible.
-
A car of mass m starts from rest and accelerates so that the instantaneous power delivered to the car has a constant magnitude P. The instantaneous velocity of this car is proportional to : (a) t'P 0...
-
Use the differential equation approach to find V0(t) for t > 0 in the circuit in Fig. P.24 and plot the response including the time interval just prior to opening the switch. 12V 12 k2
-
Set up appropriate systems of two linear equations and solve the systems algebraically. All data are accurate to at least two significant digits. The torque of a force is the product of the force and...
-
Suppose you need to image the structure of a virus with a BIO diameter of \(50 \mathrm{~nm}\). For a sharp image, the wavelength of the probing wave must be \(5.0 \mathrm{~nm}\) or less. We have seen...
-
Down Home Jeans Co. has an annual plant capacity of 65,000 units, and current production is 45,000 units. Monthly fixed costs are $40,000, and variable costs are $22 per unit. The present selling...
-
Given that Tesla is an innovative company and an industry leader in electric vehicles, what are the digital trends in new product development that they must be aware of in order to maintain their...
-
In addition to a Gantt chart, youve drawn Brian a PERT diagram so that you can communicate the necessity to keep an eye on the critical path. Consult Figure which was derived from the data from...
-
Christie Sports is retailer that sells ski and board gear, hiking and camping equipment, clothes and other accessories, which uses the high-low method for cost estimation . Management has provided...
-
After learning to set up dashboards, reports, and tools, what is the next goal?
-
During 2023, Paul Crawford, a 40-year-old single taxpayer, who is a professor at BMCC, reports the following items to his tax preparer: Salary 150,000 Federal Tax Withholding 45,000 Ordinary...
-
The average molecular weight of the 2 0 standard amino acids is 1 3 8 , but biochemists use 1 1 0 when estimating the number of amino acids in a protein of known molecular weight. Why?
-
A bank has three tellers and customers have exponentially distributed interarrival times with a mean of 1/4 minute. There is one waiting line, and the service time for each teller is exponentially...
-
Write a detailed note on accounting and its applications in our daily life.
-
Mike Ford runs a small business named Canuck Hockey Products Ltd. The company operates its manufacturing facilities in Vancouver, BC. The company designs and manufactures hockey sticks. These hockey...
-
Subprime loans have higher loss rates than many other types of loans. Explain why lenders offer subprime loans. Describe the characteristics of the typical borrower in a subprime consumer loan.
-
Write a recursive method that will reverse the order of the characters in a given string and return the result as a new string. For example, if "book" is the argument, the result would be "koob".
-
Write a program that will record the purchases made at a store. For each purchase, read from the keyboard an items name, its price, and the number bought. Compute the cost of the purchase (number...
-
Do Programming Project 9 from Chapter 8 using lambda functions to implement the button click events. Programming Project 9 Create a JavaFX application that acts as a simple calculator. Create buttons...
-
Resource leveling is a method to: a. Make sure everyone working on the project has approximately the same amount of work to accomplish b. A technique in which start and finish dates are adjusted...
-
Resources should be estimated against which entity: a. The deliverables level of the WBS b. Critical project constraints c. The Risk Breakdown Structure d. The schedule activities
-
When are the resource requirements estimated? a. After the activities have been defined but before the schedule has been developed b. After the schedule has been developed but before the activities...
Study smarter with the SolutionInn App