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
postnew [5]
3 years ago
9

Write a program that prompts the user for a word or phrase, and determines if the entry is a palindrome. A palindrome is a word

or phrase which reads the same forwards and backwards. For example, if the user entered: madam the program should display: That is a palindrome Your program should ignore spaces, commas, and apostrophes, and ignore differences between upper and lower case. For example, the phrase: Madam, I'm Adam would be considered a palindrome.
Computers and Technology
1 answer:
vekshin13 years ago
7 0

Answer:

Explanation:

The following code is written in Python. It asks the user for an input. Then cleans the input using regex to remove all commas, whitespace, and apostrophes as well as making it all lowercase. Then it reverses the phrase and saves it to a variable called reverse. Finally, it compares the two versions of the phrase, if they are equal it prints out that it is a palindrome, otherwise it prints that it is not a palindrome. The test case output can be seen in the attached picture below.

import re

phrase = input("Enter word or phrase: ")

phrase = re.sub("[,'\s]", '', phrase).lower()

reverse = phrase[::-1]

if phrase == reverse:

   print("This word/phrase is a palindrome")

else:

   print("This word/phrase is NOT a palindrome")

You might be interested in
People who work the total hours for which they get paid have
Troyanec [42]
Perfect attendance and a salary
7 0
3 years ago
Read 2 more answers
Which of the following statements should be avoided when developing a mission statement?
Citrus2011 [14]

Answer: The how-to statements

Explanation:

The mission statement is simply a short summary of the purpose of a company. It is the guideline on how a company will operate. The mission statement states the reason for the existence of a company, products sold or service rendered and the company's goals.

The mission statement should be brief but comprehensive, consist of simple words and describe the “who, what, and where” of the organization.

Therefore, the incorrect option based on the explanation above is "The how-to statements". This shouldn't be part of the mission statement.

3 0
3 years ago
The underwriters laboratories (ul) requirement for ? ground-fault circuit interrupters (gfcis) is that tripping shall occur when
Nadusha1986 [10]
The answer is Class A.  The GFCI (Ground Fault Circuit Interrupter) will “sense” the difference in the amount of electricity flowing into the circuit to that flowing out, even in amounts of current as small as 4 or 5 milliamps. The GFCI reacts quickly (less than one-tenth of a second) to trip or shut off the circuit. 
4 0
3 years ago
A bug collector collects bugs every day for seven days. Write a program in Python that finds the highest number of bugs collecte
Mama L [17]

Answer:

mylist = [ ]

for i in range(7):

   mylist.append (int(input("Enter the number of bugs for each day ")))

print(mylist)

print("The highest number of bugs is ")

print(max((mylist)))

Explanation:

  1. Create and Initialize an empty (mylist)
  2. Using the .append method, we request and add the bugs for each day into the list
  3. print out the list
  4. Use the max function to find the highest number of bugs in the list and print it out

5 0
3 years ago
Which column and row references are updated when you copy the formula f$3/15
Tasya [4]

Answer: Column F

Explanation: In Microsoft excel, for the sake of robustness and to aid the effectiveness of updating formulas across cells. The reference of cells are treated as relative which means that when formulas are copied across columns or within rows, they get updated automatically. However, some numbers may be treated as constants such that we do not want them to change or be updated as we move acisss cells. Thus, such numbers are treated Given absolute references, which is made possible by adding a '$' prefix before the colum alphabet or row number or both. in the scenario given above, the row has the $ prefix, hence, it is absolute and will not change but the column alphabet does not and hence, treated as relative.

3 0
3 years ago
Other questions:
  • Two electronics technicians are looking at the representations of a silver atom and a copper atom in the figure above. Technicia
    10·1 answer
  • Suppose that you created an robot that was so advanced it could act independently in very complex situations. It made its own de
    9·1 answer
  • Which of the following would be considered a primary source of information?
    6·1 answer
  • What are three responsibilities of an operating system? please answer quick!!!
    9·1 answer
  • Caroline is building an expert system for wartime defense. Which of these is true about the system she is building?
    14·1 answer
  • I live in Pennsylvania which observes eastern standard time.
    13·1 answer
  • Page Setup options are important for printing a PowerPoint presentation a certain way. The button for the Page Setup dialog box
    15·1 answer
  • Which feature of REPL.it would you use to transmit your program to a friend?
    12·1 answer
  • Your project will require a 7-day work week rather than the traditional 5-day. How can you adapt the software to this new schedu
    15·1 answer
  • How it/computing has impacted on engineering? <br><br> I need seven answers please help !
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!