1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sidana [21]
3 years ago
13

Implement a function printWordsLines() that takes as a parameter the name of an input file. It opens the input file and then pri

nts the number of lines and the number of words found in the file. Words are strings separated by spaces, and lines are strings terminated by the newline character. Don't forget to close the input file after you are done reading it. Sample runs:
>>> printWordsLines('test1.txt')

The file test1.txt contains 17 words and 3 lines

>>> printWordsLines('test2.txt')

The file test2.txt contains 38 words and 5 lines

use python3.7
Computers and Technology
1 answer:
Talja [164]3 years ago
7 0

Answer:

def printWordsLines(filename):

   file = open(filename, 'r')

   lines = 0

   words = 0

   for line in file:

       line.rstrip()

       lines += 1

       word = line.split(' ')

       words += len(word)

   print('the file ',filename,' contains ',words,' and ', lines, ' lines')

   file.close()

printWordsLines('words')

Explanation:

the file used was words in txt format and its contents are given as follows

hello aamir jan khan

parallelogram abdullah

anaconda ali

pycharm notebook

You might be interested in
Explain the procedure you will undertake to create a new partition​
gtnhenbr [62]
Ans: To create and format a new partition (volume) Right-click an unallocated region on your hard disk, and then select New Simple Volume. In the New Simple Volume Wizard, select Next. Enter the size of the volume you want to create in megabytes (MB) or accept the maximum default size, and then select Next.
8 0
3 years ago
Does an android tablet have a hard drive
Kisachek [45]
No, it uses flash menory
3 0
4 years ago
There is an increasing need for private security personnel because of declining resources for many government agencies and a sho
aivan3 [116]
<span>True
</span><span>There is an increasing need for private security personnel because of declining resources for many government agencies and a shortage of police officers in many communities due to lack of funding.

</span>
8 0
4 years ago
A household consists of a married couple and their twin five-year old daughters. The couples children had no income and lived wi
Colt1911 [192]

Answer:

APEX- 4.

Explanation:

4 0
3 years ago
Read 2 more answers
Meaning of mesh topology​
Pachacha [2.7K]

The meaning of mesh topology​ is that it is a type of networking that is made up of the fact that all its nodes do work together to share data amongst each other.

<h3>What is meant by mesh topology?</h3>

Mesh topology is a kind of networking that is said to be where the full nodes do act in a form of a cooperation  so that they can be able to share or distribute data among themselves.

Note that this topology was said to be first seen or developed in about an approximate of about 30+ years ago and it is one that is often used in military applications and now it is seen to be used in home automation, smart HVAC control, and others.

Hence, The meaning of mesh topology​ is that it is a type of networking that is made up of the fact that all its nodes do work together to share data amongst each other.

Learn more about mesh topology​ from

brainly.com/question/14879489

#SPJ1

6 0
2 years ago
Other questions:
  • Dan needs to ensure that delegates as well as those looking at his shared calendar information are unable to see the details of
    7·1 answer
  • Chris needs to modify the default bullets that are used in a nonnumbered list in word. Which method should he use?
    9·2 answers
  • in some caes before carrying out a command a program may ask you to provide may ask you to provide more information or to make a
    6·1 answer
  • A contractor is preparing a bid to install swimming pools at a new housing addition. The estimated time to build the first pool
    12·1 answer
  • According to Android’s suggested user interface standards, repeatedly pressing the app icon on an app’s action bar will eventual
    5·2 answers
  • Write a Python function called simulate_observations. It should take no arguments, and it should return an array of 7 numbers. E
    7·1 answer
  • Text can be inserted into a presentation by
    7·1 answer
  • What is the advantage of using a translation look-aside buffer (TLB), also called associative memory, in the logical-physical ad
    15·1 answer
  • Define the missing function. licenseNum is created as: (100000 * customID) licenseYear, where customID is a function parameter.
    12·1 answer
  • Jim wants to shoot a video. This requires him to move from one place to another. Which type of camera support should Jim use?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!