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
podryga [215]
3 years ago
9

Write a program to detect if a word or phrase is a palindrome. The program should: 1. prompt the user to enter a word or phrase

2. determine if the word or phrase is a palindrome 3. let the user know if their entry is or isn't a palindrome 4. continue asking the user for a word or phrase to check, until they provide an empty string (just hit at prompt)
Computers and Technology
1 answer:
ser-zykov [4K]3 years ago
8 0

Answer:

while True:

   s = input("Enter a word: ")

   if s != "":

       reversed_s = ''.join(reversed(s))

       if s == reversed_s:

           print(s + " is a palindrome")

       else:

           print(s + " is not a palindrome")

   else:

       break

Explanation:

- Initialize a while loop that iterates until the user enters an empty string

- Ask the user to enter a word

- If the word is not empty, reverse the word

- Check if reversed word is same as the original word. If they are same, then the word is a palindrome. If they are not same, then the word is not a palindrome.

You might be interested in
What is Mobile Edge Computing? Explain in tagalog.​
BigorU [14]

Answer:

Edge computing ay computing na tumatagal ng lugar sa o malapit sa pisikal na lokasyon ng alinman sa gumagamit o ang pinagmulan ng data, na mga resulta sa mas mababang latency at i-save ang bandwidth.

Sa isang cloud computing modelo, compute resources at serbisyo ay madalas na sentralisado sa malalaking datacenters, na kung saan ay na-access ng mga gumagamit sa gilid ng isang network. Ang modelo na ito ay napatunayang gastos bentahe at mas mahusay na mapagkukunan ng resource sharing kakayahan. Gayunman, ang mga bagong anyo ng end-user karanasan tulad ng IOT ay nangangailangan ng compute power sa kung saan ang isang pisikal na aparato o data source talagang umiiral, i.e. sa "gilid ng network."

Sa pamamagitan ng paglalagay ng mga serbisyo sa pagkompleto ng mga serbisyo na mas malapit sa mga lokasyong ito, ang mga gumagamit ay makikinabang mula sa mas mabilis, mas maaasahang mga serbisyo na may mas mahusay na mga karanasan sa gumagamit, habang ang mga kumpanya ay makikinabang sa pamamagitan ng pagiging mas mahusay na upang maproseso ang data, suporta sa mga huling sensitibong application, at gamitin ang mga teknolohiya tulad ng AI /ML analysis upang makilala ang mga trend at mas mahusay na mga produkto at mga serbisyo.

Explanation:

3 0
3 years ago
Read 2 more answers
Complete the following function to create a deep-copy on the heap of the argv array. Set the result pointer to point to your arr
irga5000 [103]

Answer:

Following are the code in the C programming Language.

//define function

void duplicate(char*argv, char**result) {

//set and initialize the variable to 0

int c = 0;

//set and initialize the char type pointer variable

char** t = argv;

//set the while loop

while(t){

//increment by 1

c++;

//increment by 1

t++;

}

//set malloc function in the pointer variable

result= malloc(sizeof(char)*(c+1));

//set the for loop

for(int i = 0; i < c; i++) {

//set malloc function in the pointer

(*result)[i] = malloc(strlen(argv[i])+1);

//copy the character from memory

memcpy(argv[i], (*result)[i], strlen(argv[i])+1) ;

}

//initialize null in the pointer

(*result)[i] = NULL;

}

Explanation:

In the following code, we define function "duplicate()" and pass two character type pointer arguments "*argv" and "**result" and inside the function.

  • Set an integer type variable "c" and initialize to 0.
  • Set character type pointer variable "t" and initialize the value of pointer variable "argv".
  • Set the while loop and increment in the variable "c" and "t" by 1.
  • Set the malloc function in the pointer variable "result".
  • Set the for loop to copy the character from the memory.
  • Finally, initialize the pointer variable "result" to NULL.
8 0
3 years ago
When you started the vi editor, you forgot to specify the name for the new file you are creating. To save steps next time, how c
zysi [14]
Vi ‘filename’
For example file called main.py
vi main.py
8 0
3 years ago
A ____ is harmful computer code that spreads without your interaction, slipping from one network to another and replicating itse
blondinia [14]
Malware is the answer

3 0
4 years ago
HELP ASAP
CaHeK987 [17]
The answer is B, e commerce. Have a good day
3 0
3 years ago
Other questions:
  • Which is missing in most areas that do not have Karst topography?
    10·2 answers
  • A(n) _____ is essentially a flash-based replacement for an internal hard drive.
    13·1 answer
  • What are some ways in which reading and writing have changed in our newly networked world
    10·1 answer
  • Which principle suggests that specific single responsibility interfaces are better than one general purpose interface?
    13·1 answer
  • Is number 1 correct​
    7·2 answers
  • In dos operating system ,write a command to delete the directory as well as the files of the directory ''world'' on drive E.
    15·1 answer
  • Is a ROUTER required for Internet Connectivity ?<br> Yes<br> No
    11·1 answer
  • Create five circles like the Olympic Rings. fill them with the colors given below
    8·1 answer
  • Plz help me I need help​
    6·1 answer
  • What is a Type 10 SD card?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!