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]
2 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]2 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
When using the following symbol, there are two arrows coming out of it. One arrow corresponds to what happens in the program if
mariarad [96]

When using the following symbol, there are two arrows coming out of it. One arrow corresponds to what happens in the program if the answer to the question if it is _______YES_____ and the other corresponds to what happens next if the answer to the question is _____NO_____ .

Explanation:

When using the following symbol, there are two arrows coming out of it. One arrow corresponds to what happens in the program if the answer to the question if it is <u>Yes and the other corresponds to what happens next if the answer to the question is No.  </u>

The Below symbol(in attachment ) is used to take decisions. This decision taking step is represented as a diamond in a flowchart.

8 0
2 years ago
Digital manufacturing has impacted our world today! List a reasons why.
Maru [420]
Because we can get manufacturing faster than usual
6 0
3 years ago
Which of the following describes the term "false information?"
pav-90 [236]
Inaccurate and misleading
3 0
3 years ago
Select the correct answer.
juin [17]

Answer:

A. <Title> tag

Explanation:

Required

Tag that can be written in the <head> element

Of the given options, <title> is correct.

This is so because, it is compulsory to have the <title> tag and the only location where it can be placed is inside the <head> tag.

Its function is to display the title of a page

e.g.

<em><title> This is my first page </title></em>

4 0
2 years ago
In powerpoint, what is line thickness measured in?
katrin [286]
Impasto. Hope this helps!
5 0
2 years ago
Other questions:
  • Typing a ____________ at the beginning of a word will exclude that word when doing a search.
    8·2 answers
  • What do the letters of the su command stand for? what can you do with su besides give yourself root privileges? "what can you do
    5·1 answer
  • The Internet may best be compared to a/an
    11·1 answer
  • Design and implement an algorithm that gets a list of k integar values N1, N2,...Nk as well as a special value SUM. Your algorit
    10·1 answer
  • Select the layer of the OSI model that is responsible for reformatting, compressing, and/or encrypting data in a way that the ap
    14·1 answer
  • For each of the threats and vulnerabilities from the Identifying Threats and Vulnerabilities in an IT Infrastructure lab in this
    10·1 answer
  • What are the correct answers?
    11·1 answer
  • D is the correct answer
    8·2 answers
  • X274: Recursion Programming Exercise: Cannonballs Spherical objects, such as cannonballs, can be stacked to form a pyramid with
    7·1 answer
  • 13. In cell B16, use the SUMIF function and structured references to display the total wins for teams in the Youth league.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!