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
nata0808 [166]
3 years ago
9

Implement the function charCnt. charCnt is passed in a name of a file and a single character (type char). This function should o

pen the file, count the number of times the character is found within the file, close the file, and then return the count. If the file does not exist, this function should output an error message and then call the exit function to exit the program with an error value of 1.
Computers and Technology
1 answer:
SVEN [57.7K]3 years ago
7 0

Answer:

Answered below

Explanation:

//Program is written in Python programming language

def charCnt( fileName, char){

if not fileName.exists( ):

return sys.exit(1)

else:

openFile = open("$fileName.txt", "r")

readFile = openFile.read( )

fileLength = len (readFile)

count = 0

for character in range(fileLength):

if readFile[character] == char:

count++

openFile.close( )

return count

}

You might be interested in
Which option is an example of a Boolean operator?<br> O A. HTML<br> O B. <br> C. SEO<br> D. NOT
gayaneshka [121]

Answer:

D

Explanation:

Boolean Operators are simple words (AND, OR, NOT or AND NOT) used as conjunctions to combine or exclude keywords in a search, resulting in more focused and productive results. ... Proximity Operators (with, near and others) can also help you in searching. See Using Proximity Operators for more details and examples.

8 0
3 years ago
Which Internet Explorer security zone includes all Internet Web sites that are not specifically assigned to another zone?
Anna007 [38]

Answer:

Internet is the correct answer for the above question.

Explanation:

  • The Internet Explorer define some security zone (which includes the Restricted sites, internet, Trusted sites, and Local intranet) which is used to block the unwanted sites which can be opened by some other websites.
  • When any user use any website, sometimes that websites open different websites. This security zone gives the features to secure the user from this event.
  • There are four-zone which are described in the first line, in which the internet zone is used to take all the websites which are not defined for the other security zone. It means that when any user does not decide the security zone for any websites then by default it comes in the internet zone.
  • This is also asked by the question, Hence "internet" is the correct answer.
4 0
3 years ago
The ________ is the biggest power consumer on a mobile computing device. display CPU memory module hard drive
user100 [1]

Answer:

CPU (Central Processing Unit)

6 0
2 years ago
Question 1<br> a node is.<br> •a sever<br> A Cell Phone<br> A Laptop<br> a device on a network
RSB [31]

Answer:

From Networkopoint of view, a node is a redistribution point or communication point or a connection point.

It can also mean devices or data points on a large network Such as laptop, phones, printers, etc

Explanation:

3 0
3 years ago
In this lesson you wrote code to make the turtle draw squares. Briefly describe how the code for
ale4655 [162]

Explanation:

that programming language you must use?

3 0
3 years ago
Other questions:
  • You can create a database using one of the many templates available or by creating a new ______ database.
    9·1 answer
  • Why is brainly not working it say im logged out rn but im not i cant acces anything but this
    12·2 answers
  • Hosts A and B are communicating over a TCP connection, and Host B has already received from A all bytes up through byte 126. Sup
    10·1 answer
  • Which word processing file that contains text and other
    13·2 answers
  • What is the nickname given to the new generation that was raised entirely within the digital age and often communicates through
    7·2 answers
  • Why is it difficult to convince top management to commit funds to develop and implement SIS
    5·2 answers
  • When backing up a database, what is added to the file name?<br> On g metrix
    9·1 answer
  • How are Earth's plates made?
    14·1 answer
  • Fill in the blanks with the correct words.
    7·1 answer
  • Why womt this code work????
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!