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
Excerpt from "How Prepared Are Students for College Level Reading? Applying a Lexile-Based Approach."
Verizon [17]

Answer: Students graduating from high school are not prepared for college-level work.

Explanation:

From the excerpt, it was written that there is a high rates of enrollment in remedial college courses which shows that there are many students are graduating from high school who are unprepared for college-level work.

Therefore, based on this, the best summary of the paragraph is that the students graduating from high school are not prepared for college-level work.

Therefore, the correct option is C.

7 0
3 years ago
I need some help with this project. The picture of the assignment is above
Mekhanik [1.2K]

Answer:

sorry

Explanation:

you need to do this on your own Wahhabi

but if you sub to my you-tube channel at chris got ha,x i will help you out

6 0
3 years ago
Which of the instances below is an example of a Trojan horse? Question 2 options: a) An attachment in an email that is really a
sergij07 [2.7K]

Game-theif Trojans is the malware that makes a backdoor into your email account by which you are playing a game or has downloaded it and thus by this all information of user is exposed.

So option D is the answer.

Option A cannot be answer because Trojan does not use files for its purpose.

Option B cannot be a good option because Trojan works in online could.

Option C cannot be a option because Trojan does not need executable to attack your account.

3 0
3 years ago
Read 2 more answers
Consider the conditions and intentions behind the creation of the internet—that it was initially created as a tool for academics
svp [43]

It should be noted that the intention for the creation of the internet was simply for resources sharing.

The motivation behind the creation of the internet was for resources sharing. This was created as a tool for academics and federal problem-solvers.

It transpired as it wasn't for its original purpose anymore. Its users employed it for communication with each other. They sent files and softwares over the internet. This led to the security vulnerabilities that can be seen today.

Learn more about the internet on:

brainly.com/question/2780939

5 0
3 years ago
What is the term that refers to an Internet marketing technique in which you pay for high search engine results by advertising o
kakasveta [241]
Im afraid if i give u an answer u’ll get confused
4 0
3 years ago
Other questions:
  • Mile markers appear as _____ green signs.
    6·2 answers
  • The most accurate reading that you can take on an analog vom are when the meters pointer is at the?
    5·1 answer
  • A website that sells high-end ties notices that its ads are showing up for searches that include "cheap". Because its ties are e
    14·1 answer
  • Describe each of the six steps of the selection process as illustrated in chapter 12
    13·1 answer
  • You have the following code: string name; cout << "Enter your name : "; cin >> name; If a user enters "Mary Smith" a
    10·1 answer
  • Match the items with their respective descriptions.
    6·2 answers
  • Inputting a range of numbers comprising a batch and then inputting each serially numbered document is characteristic of the cont
    11·1 answer
  • Help pleaseeeeeeeeeeeeeeeeee
    7·1 answer
  • List any four common hardware device​
    10·1 answer
  • How do you believe cryptocurrency work shape the next 10 years
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!