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
While using a word processor to create a project report, Ashley includes the subject, title, and the author's name in the report
Alex_Xolod [135]

Answer: Metadata

Explanation: Metadata is a type of 'data' which summarizes or gives information about data. It is used for referencing data which can be very helpful while working with such data as it brings ease and provides understanding of the data. Metadata data harbors specific details about data files such as documents, web pages, videos, images, spreadsheets. It contains information such as author, date created, title or meaning of headers or shortened names, file size.

In the scenario above, author's name, subject and title created in the report properties are Metadata which contains basic information about her report.

4 0
4 years ago
Why are rules required for a number system to be useful?
evablogger [386]

Answer

This is because without them no one would know how much each symbol represents, and no one would be able to decipher the message.

Explanation

Number system is a way to represent numbers. It  is a writing system for expressing numbers; that is, a mathematical notation for representing numbers of a given set, using digits or other symbols in a consistent manner.

In computing or in a computer number systems are the techniques which represents numbers in the computer system architecture where   every value that you are saving or getting into/from computer memory has a defined number system.Computer architecture supports  . Binary number system,Octal number system and Decimal number system.

5 0
3 years ago
Read 2 more answers
PLEASE HURRY! Match terms in the first column with the order descriptions in column two.
zavuch27 [327]

Megabytes gigabytes terabytes - from smallest to largest

Petabytes terabytes kilobytes - largest to smallest

Exabytes zettabytes megabytes - in no apparent order

Explanation:

5 0
3 years ago
5.23 LAB: Contains the character
torisob [31]

Answer:

In C++:

#include<iostream>

#include<vector>

using namespace std;

int main() {

int len;

cout<<"Length: ";  cin>>len;

string inpt;

vector<string> vect;

for(int i =0;i<len;i++){

  cin>>inpt;

  vect.push_back(inpt); }

char ch;

cout<<"Input char: ";  cin>>ch;  

for(int i =0;i<len;i++){

  size_t found = vect.at(i).find(ch);  

      if (found != string::npos){

          cout<<vect.at(i)<<" ";

          i++;

      }

}  

return 0;

}

Explanation:

This declares the length of vector as integer

int len;

This prompts the user for length

cout<<"Length: ";  cin>>len;

This declares input as string

string inpt;

This declares string vector

vector<string> vect;

The following iteration gets input into the vector

for(int i =0;i<len;i++){

  cin>>inpt;

  vect.push_back(inpt); }

This declares ch as character

char ch;

This prompts the user for character

cout<<"Input char: ";  cin>>ch;  

The following iterates through the vector

for(int i =0;i<len;i++){

This checks if vector element contains the character

  size_t found = vect.at(i).find(ch);  

If found:

      if (found != string::npos){

Print out the vector element

          cout<<vect.at(i)<<" ";

And move to the next vector element

          i++;

      }

}  

7 0
2 years ago
How many types of sharing of Google Forms are possible?
scoray [572]

Answer:

Open a form in Google Forms.

In the top right, click More .

Click Add collaborators.

Under "Invite people," type the names or email addresses of the people you want to work with.

Click Send.

8 0
4 years ago
Other questions:
  • Write a method void Print(int LastNumber, int numbersPerLine) that receives two integers
    15·1 answer
  • You want to place a video from the internet to your desktop. what process do you use?
    15·1 answer
  • Write a program to read customer number, Name, loan amount, interest rate and time of repayment. Calculate and display the EMI .
    9·1 answer
  • The internet shopping cart is an example of which version of the web?
    11·1 answer
  • What feature adjusts the top and bottom margins so that the text is centered vertically on the printed page?
    14·1 answer
  • Which term describes the distance from one point on a wave to the same point on the next wave?
    13·2 answers
  • Compter History Large Resume Include: the beginnings of the computer and its development during the years The events of computer
    10·1 answer
  • Help me? ill do anything ill let u smash me or anything just HELP!
    15·2 answers
  • Discuss at least 1 Microsoft Windows security features that could protect data?
    5·1 answer
  • Previous
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!