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
Nataly_w [17]
3 years ago
5

Write a function analyze_text that receives a string as input. Your function should count the number of alphabetic characters (a

through z, or A through Z) in the text and also keep track of how many are the letter 'e' (upper or lowercase). Your function should return an analysis of the text in the form of a string phrased exactly like this: "The text contains 240 alphabetic characters, of which 105 (43.75%) are ‘e’."
Using function
Computers and Technology
1 answer:
laiz [17]3 years ago
5 0

Answer:

def analyze_text(sentence):

   count = 0

   e_count = 0

   for s in sentence:

       s = s.lower()

       if s.isalpha():

           count += 1

       if s == "e":

           e_count += 1

   return "The text contains " + str(count) + " alphabetic characters, of which " + str(e_count) + " (" + str(e_count*100/count) + "%) are ‘e’."

Explanation:

Create a function called analyze_text takes a string, sentence

Initialize the count and e_count variables as 0

Create a for loop that iterates through the sentence

Inside the loop, convert all letters to lowercase using lower() function. Check each character. If a character is a letter, increment the count by 1. If a character is "e", increment the e_count by 1.

Return the count and e_count in required format

You might be interested in
Janice has decided that the best approach to programming a new social media app is to start with a small portion of it by writin
Maru [420]

Answer:

blacc

bhhj

Explanation:

4 0
3 years ago
The ____ option must be used when running a program in order to see the results of assert statements.
Lera25 [3.4K]

Answer:

-ea

Explanation:

We can enable or disable assertions in java, by default this assertions are disabled at runtime, but we can use two commands, for example, if we want to enable assertions at various granularities, we can use the -enableassertions, or -ea, switch, if we want to disable at various granularities, is -disableassertions, or -da.

4 0
3 years ago
TRUE OR FALSE!!!!!
VladimirAG [237]
The answer is True.
6 0
3 years ago
Read 2 more answers
What is mean by computer ?where it is used?​
dem82 [27]

Answer:

computer is a set consisting of hardware and software that perform specific set of instructions

Explanation:

thy are used in hospitals, institute,hotels

4 0
2 years ago
Why am i doing the investigation​
juin [17]
Because it’s your interest
6 0
3 years ago
Other questions:
  • A built-in tool that enables you to use text to type in commands for the operating system is called the _____ prompt.
    10·2 answers
  • Select all that apply. To select more than one worksheet at the same time, which of the following keys on your keyboard can you
    11·1 answer
  • What formatting option is easiest to read when printed out
    12·1 answer
  • What is the purpose of application software policies?
    12·1 answer
  • Which of the following is the best definition of a workplace policy?
    13·1 answer
  • One form of e-mail attack that is also a DoS attack is called a mail spoof, in which an attacker overwhelms the receiver with ex
    14·1 answer
  • Hi All,
    12·2 answers
  • How many of you got the right answer from this app​
    8·1 answer
  • Write a function check_palindrome that takes a string as an input and within that function determines whether the input string i
    12·1 answer
  • Which of the following statements are true about file naming conventions? Check all of the boxes that apply.
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!