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
HELP PL
Nikolay [14]
A. journals

Medical journals, or scientific journals are always a good source for information for something like this!
3 0
4 years ago
Read 2 more answers
A function may return a pointer, but the programmer must ensure that the pointer:
elena-14-01-66 [18.8K]
Hello i am kust gere to answer the qustions nothing else
4 0
4 years ago
A cybersecurity analyst is currently investigating a server outage. The analyst has discovered the following value was entered f
drek231 [11]

Answer:D)Format string attack

Explanation:

Format string attack is the type of attack that causes to change the application functioning .This attack access the memory of the string library. It occurs while the submission of the string as input and then gets tested due to application command.

Other options are incorrect because these are the attacks that don't happens in the application for the alteration of the flow. Thus, the correct option is option(D).

8 0
3 years ago
Circular errors are caused by adding the cell name of _______ cell to its own formula.
Sati [7]

Circular errors are caused by adding the cell name of the active cell to its own formula.

8 0
3 years ago
What are examples of real-time applications
Savatey [412]

Typical examples of real-time systems include Air Traffic Control Systems, Networked Multimedia Systems, Command Control Systems etc.

3 0
4 years ago
Other questions:
  • Edmund wants to visit his university's website. Which software application would he use?
    14·1 answer
  • Many professional photographers take pictures of people. What skills would someone have to have to be successful in these types
    13·1 answer
  • Which category of system software provides a platform for application software to run on?
    12·2 answers
  • A constructor: A. always accepts two arguments B. has return type of void C. has the same name as the class D. always has an acc
    9·1 answer
  • In the cis configuration, the methyl groups are placed _____.
    8·2 answers
  • When changing printer settings, which of the following statements is true?
    13·1 answer
  • What are the trinity of the computer system
    15·1 answer
  • Helpppppp meeeeeeeeeeeeeeeeee
    12·1 answer
  • Evaluate how suitable the hardware would be for:
    12·1 answer
  • Why is a Quality assurance tester needed on a software development team?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!