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
) The _____ method of a radio button returns true if that button is on.
Lostsunrise [7]

Answer:

isSelected()

Explanation:

The isSelected() method of a radio button returns true if that button is on and false otherwise. This method is defined in the class javax.swing.AbstractButton. JRadioButton class inherits from AbstractButton and thus has access to this method. An application code can invoke this method on the radio button instance to determine th ecurrent state and alter the control flow accordingly.

4 0
3 years ago
The handle in a selected object’s upper-left corner is the ___________handle.
Lynna [10]

Answer: Move handle

Explanation: In the field of the database, the unique identifier for an object is created that is known as handle which is for the driving purpose in the database.It is also used for the connection of the database .The object in the database containing data keeps the management of the handle.

It has a handle named move handle ,which is responsible for the movement control of upper left corner in an object.It is in a large in form for the dragging of the object that is selected.

6 0
4 years ago
A device which is not connected to the cpu is known as?​
Dvinal [7]

Answer:

would be called an Off-line device

3 0
3 years ago
Create a recursive method, a method that calls itself, that returns true or false depending on whether or not a given string is
ICE Princess25 [194]

Answer:

public class CheckPalindrome{

public static boolean IsPalindrome(String str){

if(str.Length<1)

{

return true;

}

else

{

if(str[0]!=str[str.length-1])

return false;

else

return IsPalindrome(str.substring(1,str.Length-2));

}

}

public static void main(string args[])

{

//console.write("checking palindromes");

string input;

boolean flag;

input=Console.ReadLine();

flag= IsPalindrome(input);

if(flag)

{

Console.WriteLine("Received"+input+"is indeed palindrome");

}

else

{

Console.WriteLine("received"+input+"is not a palindrome");

}

}

Explanation:

6 0
3 years ago
What refers to the way that a user gets data from a computer, such as
Vera_Pavlovna [14]

Answer:

Possibly IOT or internet of things. Not 100% sure if I am understanding question fully

Explanation:

4 0
3 years ago
Other questions:
  • By default, the pfsense firewall allows unrestricted outbound access from the lan interface. true or false?
    7·2 answers
  • Which of the following is necessary to effectively navigate online?. A. You must be able to identify important questions. B. You
    12·1 answer
  • A technician is trouble-shooting an IDE hard drive that is emitting a humming sound. They suspect a faulty connector. Which of t
    6·1 answer
  • Suppose that you need to access a data file named "students.txt" to hold student names and GPAs. If the user needs to look at th
    9·1 answer
  • Bulldog Holdings is a U.S.-based consumer electronics company. It owns smaller firms in Japan and Taiwan where most of its cell
    5·1 answer
  • What are 5 ways we can reduce our energy?
    5·1 answer
  • 1. Empty tags do not have ___________.
    14·1 answer
  • What icons in the toolbar change the look of the presentation text? It’s either Drawing, Formatting,Presentation, or Standard
    9·2 answers
  • A user purchased a new smart home device with embedded software and connected the device to a home network. The user then regist
    5·1 answer
  • Question:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!