Calculate three statistics about in file

Assignment Help Basic Computer Science
Reference no: EM132270129

Write the function named file_stats that takes one string parameter (in_file) that is the name of an existing text file. The function file_stats should calculate three statistics about in_file: the number of lines it contains, the number of words and the number of characters, and print the three statistics on separate lines. For example, the following would be correct input and output:

>>> file_stats('created_equal.txt')

lines 2

words 13

characters 72

Note: The number of characters may vary slightly between operating systems. Similarly, the number of lines may vary by 1 line, depending on the method used to calculate it.calculate three statistics about in_file

Reference no: EM132270129

Questions Cloud

Provider based on the functions of the business : Explain new risks associated with using cloud services based on the functions of the business? (detailed answer please)
Write the function named initialletters that takes : Write the function named initialLetters that takes one parameter, wordList - a list of words. Create the return a dictionary in which each initial letter
Write the function named initiallettercount : Write the function named initialLetterCount that takes one parameter, wordList - a list of words. Create the return a dictionary in which each initial letter
Write the output file to that directory : Assume that the input file is in the current working directory and write the output file to that directory.
Calculate three statistics about in file : Write the function named file_stats that takes one string parameter (in_file) that is the name of an existing text file. The function file_stats should calculat
Controls to address the issues you have identified : Your task is to review the requirements and design proposed along with other relevant information provided, present any potential threats and recommend security
How would each chart differ in representing your data : If choosing between pie chart and a line chart, what factors would you evaluate in choosing which one to use? How would each chart differ in representing
How would you evaluate the risk of your investment : Pick two of the major stock indices; explain what type of companies they represent and discuss what could be the purpose of monitoring those indices.
What is the purpose of system calls : What is the purpose of system calls, and how do system calls relate to the OS and to the concept of dual-mode (kernel-mode and user-mode) operation?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Wireless networks of various types

More and more traffic is being moved to wireless networks of various types. Write a 500-word paper that discusses the issues that occur when voice traffic is sent over a typical wireless local area network, such as what the advantages are, the pro..

  Find the probability that the sample proportion

Find the probability that the sample proportion will be at least 0.30. Give answer to 4 decimal places.

  What is the purpose of the setdata method

What are the names of the private data members in the Item class?

  What is the pseudocode for with the solution

Calculate and display the wieght 3. If the wieght is greater than 500, indicate the wieght is too heavy 4. If the wieght is less than 100, indicate that object

  Derive the equations for transforming from rgb to cie

Derive the equations for transforming from RGB to CIE XYZ, and back. This is a linear transformation. It is sufficient to write out the expressions.

  Give a reason why a context switch between threads

Give a reason why a context switch between threads may be cheaper than a context switch between processes.

  Cutting-edge or standards-based web programming

In the world of programming, there is often a dichotomy between Web programmers advocating cutting-edge techniques and those supporting well-established standards. To the former, new techniques may represent greater possibilities. Looking at the p..

  Prepare a draft of a statement of purpose

You have prepared a draft of a statement of purpose that you will include in an application packet to each university to which you apply.

  What is the price elasticity

Please explain how you got the answer to this question! You have the following demand for a pack of cigarettes: Q=200- 0.30P with the average quantity of 3 packs and average price of $3.00 per pack. What is the price elasticity?

  Picture of the binomial graph

Calculate the probability that of receiving a passing grade on the quiz, by randomly guessing the answers? (HINT: the probability of success on a single trial

  Relationship between a monopolist''s demand curve

What is the relationship between a monopolist's demand curve and the market demand curve?

  Discuss how multiculturalism and diversity play roles

Topic: Discuss how multiculturalism and diversity play roles in diagnosis and treatments. Are there barriers in providing quality healthcare to communities due to the racially and ethnically diverse population? What do you think can be done to meet t..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd