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
Jim wants to shoot a video. This requires him to move from one place to another. Which type of camera support should Jim use?
Arisa [49]

Answer:

I think Jim should use a movement tracker camara

Explanation:

since he is moving around the camera would follow him around

8 0
3 years ago
3. Creat an Algorithm and Flowchart that will accept temperature in Kelvin then convert to celcius. Using the formula:
ehidna [41]

Answer:

.

Explanation:

nsjajanabdmwkqiahsb

5 0
3 years ago
1. What was the very first “photo-realistic CGI character” to appear on-screen in a movie (released in 1985)?
lions [1.4K]

Answer:

Do you know the answer.

4 0
3 years ago
Read 2 more answers
ANSWER QUICKLY!!
Alina [70]

Answer: I did some research I narrowed it down to page link and page break so I think it might be page link but look up page break and you will see what I think it might be that ok hope this helps.

8 0
2 years ago
why cant i answer "tutor verified" answers? They have low ratings usually but I am unable to also answer the questions. Why is t
Sphinxa [80]

Answer:

i think bc you have to be a tutor or it could be a glitch

Explanation:

3 0
2 years ago
Read 2 more answers
Other questions:
  • What is the data rate of a DS0 signal?
    10·1 answer
  • What are the cause of eye strain during computer usage?
    7·1 answer
  • My home PC has IP address 192.168.1.22 and connects to the Internet through a NAT router. Assume I am downloading a web page fro
    5·1 answer
  • How many generations of computer languages have there been since the middle of the 20th century?
    9·2 answers
  • The common programming structure that implements "conditional statements" is called an____ statement.
    8·1 answer
  • Suppose you have the following declaration.int[] beta = new int[50];Which of the following is a valid element of beta.(i) beta[0
    14·1 answer
  • A security utility program that scans the system for small programs that interfere with how a computer functions are _____ utili
    13·1 answer
  • A cable that connects the computer to the printer is an example of<br> A.hardware<br> B.software
    13·2 answers
  • What was the first video game ever invented
    11·2 answers
  • Your team has provisioned an Auto Scaling Groups in a single Region. The Auto Scaling Group at max capacity would total 40 EC2 i
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!