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
frozen [14]
3 years ago
12

Your task is to build a palindrome from an input string.A palindrome is a word that readsthe same backward or forward. Your code

will take the first 5 characters of the user input, and create a 9-character palindrome from it.Words shorter than 5 characters will result in a runtime error when you run your code. This is acceptablefor this exercise, however you already know how to validate user input with an IF statement.Some examplesof input words and the resulting palindromes:
Computers and Technology
1 answer:
White raven [17]3 years ago
7 0

Answer:

The program in Python is as follows:

word = input("Word: ")

if len(word) < 5:

   print("At least 5 characters")

else:

   pal = word[0:5]

   word = word[0:4]

   word = word[::-1]

   pal+=word

   print(pal)

Explanation:

This gets the word from the user

word = input("Word: ")

This checks if the length of the word is less than 5.

if len(word) < 5:

If yes, this tells the user that at least 5 characters is needed

   print("At least 5 characters")

If otherwise

else:

This extracts the first 5 characters of the word into variable named pal

   pal = word[0:5]

This extracts the first 5 characters of the word into variable named word

   word = word[0:4]

This reverses variable word

   word = word[::-1]

This concatenates pal and word

   pal+=word

This prints the generated palindrome

   print(pal)

You might be interested in
What is anatomy of software house?
alexira [117]

Answer:

2. All reports of software house.

Explanation:

A software house is a business providing software products mainly. These firms may be specialized in products for company or consumer software or software-as -a-service (SaaS). The popular definition is that the firm is invested primarily in software product development and distribution.

In anatomy of software house they include-

  • Software development
  • Finance report
  • Client report
  • Sales and marketing report

It consist all reports like finance,client,sales or development of software house.

4 0
3 years ago
This is a free point thing!! I am giving 100 points!! Anyone wanna talk!!!!
julia-pushkina [17]

Answer:

:)

Explanation:

8 0
3 years ago
Read 2 more answers
Why was the first computer developed? a.) for personal use, b.) for military purposes, c.) for transportation, d.) for communica
IgorLugansk [536]
B) For Military Purposes but around the 1970s they became widely available to consumers.
5 0
3 years ago
¿Por qué es importante aprender a programar?
White raven [17]

Answer:

Es importante aprender a programar, por que es el mismo de que alguen aregle su carro. En estos tiempos, la technolagia se ha convertido en la nueva normal. Va vinir el tiempo quando nosotros necesitamos que arreglar un linia de codigo en nuestras computadoras, y no esta necesario para pagar alguen que ellos lo agan. Como quando necesitas que poner una llanta nueva a tu carro. Tu lo puedes cambiar solo. Entonses como el ejemplo del carro, tu puedes arreglar el linia de codigo en la computadora sin pagar alguen por acerlo.

7 0
3 years ago
Can some one help please
quester [9]

Answer:

I think its screenplay

Explanation:

Firstly, the question starts with an a so it can't be b. And format can't be repeated. Which leaves us with screenplay.

Hope this helps.

8 0
1 year ago
Other questions:
  • The Huntington Boys and Girls Club is conducting a fundraiser by selling chili dinners to go. The price is $7 for an adult meal
    8·1 answer
  • Why does people that gets abused not report?
    5·1 answer
  • Part cost Calculator Modify the GUI in your program to look like the following GUI. To do that you need to add the following to
    13·1 answer
  • 5. RAM IS YOUR SYSTEM’S-
    14·2 answers
  • If you were required to give a speech identifying the risks of using computers and digital devices, which group of items would y
    7·1 answer
  • Your digital footprint says a lot about you, but not everything is true or accurate. When you're a high school or college studen
    13·1 answer
  • What are 3 software programs for mobile computing?
    10·1 answer
  • To delete unnecessary files on a hard disk use software
    5·2 answers
  • Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as t
    14·1 answer
  • Which directory contains the initrd file? in suse linux
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!