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
It's the same drop-down answers for both.
tia_tia [17]

Answer:

First, medium: can see all the subject but maintain the focus in him

Second, close-up: To se the facial expressions and emotions

5 0
2 years ago
2) What is the value stored in the variable z by the statements below?
Dmitriy789 [7]

Answer:

7

Explanation:

Because the q.length is a inbuilt function in the programming which used to get the length of the array. In the array, there are 7 values are store. Therefore, the size 7 store in the variable z.

For example:

int[] array={1,2};

int x = array.length;

the answer of above code is 2, because the elements present in the array is 2.

 

5 0
2 years ago
On which tab are import and export commands located in Access? A. Home B. Database Tools C. External Data D. Create
Ann [662]

Answer:

C. External Data

Explanation:

On the External Data tab, you can find import and export commands located in Access.

7 0
3 years ago
____ uses markup to define the structure and layout of a web document.
cupoosta [38]
HTML: Hyper Text Markup Language.

HTML is the markup language used for defining the structure, and very basics of a web page - one wouldn't be possible without this language!

HTML is combined with CSS (Cascading Style Sheet) to improve visuals, and combined with a language such as Javascript to add functionality and interaction with the web page.
8 0
3 years ago
How many bits would be used to count the students in class today?There are 10 students
Vikentia [17]

Answer:

4 bits

Explanation:

With 4 bits you can count to 15, because 2⁴=16. The maximum number you can express is always one less, i.e., 16-1=15.

In general, with n bits you can count to 2ⁿ-1.

7 0
3 years ago
Read 2 more answers
Other questions:
  • )How to extract a specific element of item in a list?
    13·1 answer
  • Greg works for online games development company. He occasionally visits online literature sites and downloads e-books of his cho
    12·2 answers
  • Why should spain go to Africa ​
    15·1 answer
  • Black Ops 3 For Ps4 Players Here
    7·1 answer
  • How do you recognize the brand name of a drug in the package insert?
    15·1 answer
  • Five features of any window​
    14·1 answer
  • You can get context-sensitive help information from the Code Editor by_________.A) selecting Contents from the Help menu
    9·1 answer
  • How do you change the Background image or picture on Windows desktop?
    9·1 answer
  • HELP!!!!!!!
    8·1 answer
  • To make the monster pace, you needed the monster to turn ___ degrees.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!