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
Wittaler [7]
4 years ago
14

File Letter Counter

Computers and Technology
1 answer:
Zanzabum4 years ago
5 0

Answer:

The solution code is written in Python.

  1. fileName = input("Enter file name: ")
  2. target = input("Enter target character: ")
  3. with open(fileName, "r")as reader:
  4.    content = reader.read()
  5.    print(content.count(target))

Explanation:

Firstly, use <em>input() </em>function to prompt user for a file name. (Line 1)

Next, we use input() function again to prompt user input a target character (Line 2)

Create a reader object and user <em>read() </em>method to copy entire texts from to the variable<em> content </em>(Line 4 - 5).

At last we can get the number of times the specified character appears in the file using the Python string built-in method <em>count() </em>(Line 6)

You might be interested in
How has the Aswan High Dem had an adverse effect on human health?​
Lorico [155]

Answer:

How was the Aswan high dam had an adverse effect on human health? It created new ecosystems in which diseases such as malaria flourished. An environmental challenge facing the Great Man Made River is that pumping water near the coast. ... Water scarcity makes it impossible to grow enough food for the population.

Explanation:

7 0
3 years ago
Why is this app here to help but wont let me see answers to my questions?
UkoKoshka [18]

Answer:

maybe you need to reload the page and press the little bell on the right side and u should get a notification when somebody answers your question and if that doesnt help go to your profile and press the tab (on this tab if that makes since) it should say sumin like questions you asked and u should press the ones u need the answers to

Explanation:

lmk if this helped

5 0
3 years ago
Read 2 more answers
Cache memory and RAM both are based on transistor based then why cache memory is needed if we already have RAM (Random Access Me
attashe74 [19]
I would tell you but nah because I do math so yeah thanks yes
6 0
3 years ago
Write a program that: Takes the list lotsOfNumbers and uses a loop to find the sum of all of the odd numbers in the list (hint:
Alika [10]

Answer:

Following are the code to this question:

#include <iostream>//defining header file

using namespace std;

int main()//defining main method

{

int x[]={2,3,4,6,7,8,9,1,11,12};//defining 1-D array and assign value

int i,sum=0;//defining integer variable

for(i=0;i<10;i++)//defining loop for count value

{

   if(x[i]%2==1)//defining if block to check odd value

   {

       sum=sum+x[i];//add value in sum variable

   }

}

cout<<sum;//print sum

return 0;

}

Output:

31

Explanation:

In the above-given program, an integer array "x" is declared that holds some integer values, and in the next line two integer variable "i and sum" is defined which is used to calculate the value.

In the next line, a for loop is declared, that counts all array value, and it uses the if block to check the odd value and add all the value into the sum variable.

5 0
3 years ago
There is a wealth of
muminat

Answer:

empathy for others

Explanation:

The Journal, Reading Psychology, written by John McCreary and Merchant Gregory, explores the relationship between reading and empathy. Controlling for gender, GPA, and reading variables were hypothesized as closely related to empathy. Reading literary fiction engages us with social and psychological complexities of life. They require us to become someone else by transporting ourselves into the situations of others and their minds. Reading some Harry Potter books, for instance, should have a similar impact. Parts of his book tested how Harry had to deal with prejudice by showing more empathy towards immigrants and homosexuals than those who knew how to read neutral passages.

7 0
3 years ago
Other questions:
  • If you value achievement, which of the following is important to you?
    7·2 answers
  • The Task Manager cannot be used to turn Services on and off.<br> True or False?
    8·2 answers
  • What is the name of small programs stored on the hard drive that tell the computer how to communicate with a specific hardware d
    5·1 answer
  • Businesses finance their operations using a mixture of ______. debt,
    14·1 answer
  • What’s the screen that displays results from typing text, performing calculations or running programs?
    9·1 answer
  • the part of the computer that provides access to the internet is the A.modem B. keyboard C. monitor or D.system unit
    7·2 answers
  • What will be displayed after the following statements execute? int funny = 7, serious = 15; funny = serious 2; if (funny != 1) f
    7·2 answers
  • List the steps you took to configure SERVERC and take a screen shot of the Connect to DNS Server dialog box by pressing Alt+Prt
    11·1 answer
  • WAP to input the rating of a movie, and print as per the given criteria:
    13·1 answer
  • Write a program that prompts the user for two numbers then outputs the result of dividing the first number by the second number
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!