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]
2 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:
vekshin12 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
Choose the answer.
Alik [6]
A home network aswell business networking would use a Router to connect the lam and internet all together
3 0
2 years ago
Read 2 more answers
Please help me idk I suck at this stuff ​
kap26 [50]
I would say the best clear answer is D, because A is a little bit unclear but I would say the best answer is D.

Why?

Mesh Topology is expensive considering more links as compared to Ring topology.


4 0
2 years ago
Excel Enterprises uses a Web​ site, online social​ networks, and print advertisements to promote its products. Since Excel Enter
Nuetrik [128]

Answer:

Consistency

Explanation:

Bi integrating marketing communications, we can infer that the different brands working under Excel Enterprises have the same basic design, so the marketing department can sell their features easily, without having to create different campaigns or protocols for each individual product.

This homogeneous design then turns intuitive for the user, a textbook definition of consistent design, and the tone is maintained through the different brands.

Just like when you move from Microsoft's Excel to Microsoft's Word, you know the usage of each program is different, but the layout is the same, allowing you to understand the basics of the UX (user interface) of one, by understanding the other.  

4 0
3 years ago
Read 2 more answers
Public class SomeClass { private String aName; private int aNumber; private boolean amAwesome; public SomeClass(String name, int
scoray [572]

Answer:

The objects created in the main method and their initial states are given below

Explanation:

The objects and initial state of each object( the values of each object’s variables) are thus:

We have objects awesome, amazing and fantastic.

initial state of awesome object is

aName = "Awesome"; aNumber = 5; amAwesome = true;

initial state of amazing object is

aName = "Amazing"; aNumber = -10; amAwesome = false;

initial state of fantastic object is

aName = "Fantastic"; aNumber = 11; amAwesome = true

3 0
3 years ago
Which of these is an off-site metric for social media marketing?
Fudgin [204]
I will have to say c




3 0
2 years ago
Read 2 more answers
Other questions:
  • ​a(n) ____ is a communications device that connects a communications channel such as the internet to a device such as a computer
    11·1 answer
  • Which is a real-world example of a procedure?
    11·1 answer
  • Lewis is using a stylus with his touch screen computer in order to draw a
    8·1 answer
  • If you buy a 20 dollar thing with a 25 dollar gift card, do you still have 5 dollars?
    7·2 answers
  • Write a function called simulate_several_key_strikes. It should take one argument: an integer specifying the number of key strik
    7·1 answer
  • Which of the following is a term used for the permanent record of activities performed on the Internet?
    11·1 answer
  • Write a statement that toggles the value of the bool variable onoffswitch. that is, if onoffswitch is false , its value is chang
    10·1 answer
  • Select the correct answer.
    12·2 answers
  • Provide examples of the cost of quality based on your own experiences
    14·1 answer
  • Eun-Joo is working on a circuit board. There is no electrical current flowing through a certain switch on the circuit board.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!