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]
2 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]2 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
Kyra is teaching a photography class. She would like her students to share photos. She would also like the students to be able t
SIZIF [17.4K]

Answer:

A blog.

Explanation:

A blog can be defined as an informative or discussion-based website that is updated regularly and published over the internet. The informations that are posted on a blog are usually done chronologically and it includes pictures, videos, music, movies, novels, etc.

In this scenario, Kyra is teaching a photography class. She would like her students to share photos, be able to review other students' photos and offer feedback.

Hence, the technology Kyra should use is a blog because it would avail the users (students) to post photos, make comments on blog posts and review items posted by others.

6 0
2 years ago
Which is a basic job requirement for a career in corrections services?
Diano4ka-milaya [45]

You must have a high school diploma

7 0
3 years ago
Choose the answer that best completes the
Fiesta28 [93]

Answer:

the information processing cycle

Explanation:

3 0
2 years ago
Read 2 more answers
How to create a comparator generic type in java.
KIM [24]

Answer:

public class Person {

//fields

private int id;

private String name;

private Payment pay;

//constructor

public Person(String name, int id,

int startSal, int startBon){

this.name = name;

this.id = id;

this.pay = new Payment(startSal, startBon);

}

//method get name

public String getName(){

return name;

}

//method get id

public int getId(){

return id;

}

//method get start salary

public int getStartSalary(){

return pay.startSalary;

}

//method get start bonus

public int getStartBonus(){

return pay.startBonus;

}

//inner payment class

private class Payment{

int startSalary;

int startBonus;

public Payment(int sal, int bon){

this.startSalary = sal;

this.startBonus = bon;

8 0
2 years ago
What are common tasks Human Services workers perform? Check all that apply.
Ainat [17]

Answer: B, D, E, F

Explanation:

I got I right.

7 0
3 years ago
Read 2 more answers
Other questions:
  • c++ design a class named myinteger which models integers. interesting properties of the value can be determined. include these m
    14·1 answer
  • During an interview, your non-verbal communication (body language, gestures, tone of voice, speed of talking,
    6·1 answer
  • Are headphones considered a computer? Why or why not?
    13·2 answers
  • To support continuous improvement efforts in the workplace, you increase the number of tasks that an employee performs and have
    7·1 answer
  • At age 16 Cheyanne just got her drivers license
    5·2 answers
  • What feature of Windows Server allows for agentless authentication?
    7·1 answer
  • Which ofthe following sentence beginnings would be best to use in apersuasive request?
    8·1 answer
  • Complete the sentence with the correct response.
    12·1 answer
  • What is meant by reflection?​
    9·2 answers
  • Write the technical terms for the following statements: The repeated working capacity of computer.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!