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
What color is the highway sign that indicates restaurant?
Rina8888 [55]
Its perhaps blue colour .
Hope this helps !!

5 0
3 years ago
Hyperlinks are a part of an HTML element called a(n) _____.
Lyrx [107]

The Anchor element.

HTML element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address. Content within each <a> should indicate the link's destination.

6 0
2 years ago
Read 2 more answers
_____ is an advanced optical disc technology that can store up to 3.9 terabytes, roughly 75–150 times more data than the Blu-ray
Anettt [7]

Answer:

"The holographic versatile disc".

Explanation:

According to my research on optical disk technology, I can say that based on the information provided within the question the technology being described in the question is called a "The holographic versatile disc".

Unfortunately it is not shown as an available answer but it is the correct answer. This is the only optical disk technology capable of holding 3.9 terabytes of data as well as meeting the specs mentioned in the question.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

7 0
4 years ago
Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the int variable
levacccp [35]

Answer:

if (pH<7.0){

          neutral=0;

          base=0;

          acid=1;

      }

      else if (pH>7.0){

          neutral=0;

          base=1;

          acid=0;

      }

      else if (pH==7.0){

          neutral=1;

          base=0;

          acid=0;

      }

Explanation:

As required by the question, if and else statements have been used to test the value of the pH and assign the apropriate values to the variables neutral, base and acid.

The code snippet below can be used to prompt the user to enter values for pH

<em>import java.util.Scanner;</em>

<em>public class pHTest {</em>

<em>   public static void main(String[] args) {</em>

<em>      Scanner scr = new Scanner(System.in);</em>

<em>       System.out.println("Enter a value for the pH");</em>

<em>       int neutral, base, acid;</em>

<em>       double pH = scr.nextDouble();</em>

<em> if (pH<7.0){</em>

<em>           neutral=0;</em>

<em>           base=0;</em>

<em>           acid=1;</em>

<em>       }</em>

<em>       else if (pH>7.0){</em>

<em>           neutral=0;</em>

<em>           base=1;</em>

<em>           acid=0;</em>

<em>       }</em>

<em>       else if (pH==7.0){</em>

<em>           neutral=1;</em>

<em>           base=0;</em>

<em>           acid=0;</em>

<em>       }</em>

<em>} }</em>

4 0
4 years ago
Read 2 more answers
Public abstract class Playerpublic class ComputerPlayer extends Player;public class SmartComputerPlayer extends ComputerPlayer;C
ZanzabumX [31]

Here's the full question;

<em>Assume the following partial declarations have been made, with default (no parameter) constructors for the classes.</em>

<em />

<em>public abstract class Player</em>

<em>public class ComputerPlayer extends Player;</em>

<em>public class SmartComputerPlayer extends ComputerPlayer;</em>

<em />

<em>Consider the following declarations.</em>

<em />

<em>I. ComputerPlayer playerA = new SmartComputerPlayer();</em>

<em>II. Player playerB = new SmartComputerPlayer();</em>

<em>III. Player playerC = new Player();</em>

<em />

<em>Which of these declarations will compile correctly?</em>

A.) I only

B.) II only

C.) III only

D.) I and II

E.) II and III

<u>Answer:</u>

<u>C)</u>

Explanation:

One of the rules of Java programming is that it must have a class which is a blueprint that informs about the behavior that the object of that class support.

If we go by the strict rules of Java programming only the class declaration;

Player playerC = new Player();

would compile correctly.

All other options would result in compiler error.

6 0
3 years ago
Other questions:
  • A ________ is a small text file passed to a web browser on a user's computer by a web server.
    7·1 answer
  • Websites often request information about you. You have a choice as to whether or not you provide this to them. What aspect of PA
    12·1 answer
  • What is the purpose of copyfitting?
    12·1 answer
  • Which kind of system software tells the computer how to communicate with peripherals, such as a prero
    6·2 answers
  • Universal Containers (UC) has a great user interface for their Customer Community Knowledge Base. UC has multiple Communities an
    15·1 answer
  • Need help!! Write an interactive program that reads lines of input from the user and converts each line into "Pig Latin." Pig La
    9·1 answer
  • Which is the fastest CPU and why?
    5·1 answer
  • If the user does NOT click the button what color will "topButton" be when this program finishes running?
    6·1 answer
  • Pls help me!! I will give 35 points and mark brainliest !!!
    10·1 answer
  • Cans someone pls help me to do edhesive 2.5 code practice
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!