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
Circular errors are caused by adding the cell name of a/an _______ cell to a formula.
Reil [10]

Correct answer choice is :

D) Active

Explanation:

Many of people working in Excel don’t know why they see the circular reference error note right after they’ve enrolled an equation. The information indicates that your code is seeking to determine its own cell–kind of like when a puppy follows its own tail.

5 0
3 years ago
Read 2 more answers
If String str = "Computer Science";, then what is the value of str.substring(10);? ​
Genrish500 [490]

Answer:

cience

Explanation:

From the question, the string variable str was initialized to "Computer Science:

str.substring(10) implies that we get a substring starting from the character at the 10th index till the last index

In this case, the 10th index character is c

So, the instruction will return cience

3 0
3 years ago
I need help making this table in html code I have some of chart done but idk where to go after the 6:30pm part
Bumek [7]

dvioubfeevuf is hsvqvuvsqv

5 0
3 years ago
A block style business letter is
Molodets [167]

Answer:

Block style is a special style or format that is adopted to write Business Letters.

Explanation:

We all know that for writing Business Letters a formal style is adopted in order to convey important information regarding business matters.

So by following Block Style in the Business Letters we mean to write the letter according to the rules below:

Text for the letter should be justified Left completely.

Single spacing should be used for text.

Double spacing should be used for paragraphs.

1 inch margin should be left on each side.

Built-in Letter Wizard for formatting can also be used while dealing with BLOCK STYLE FOR BUSINESS LETTERS.

I hope it will help you!

7 0
3 years ago
What changes could you make so that a message, "User input deemed invalid." during designing a simple calculator program for you
Afina-wow [57]

The most appropriate change in this situation would be to change the message "User input deemed invalid" to "You made a mistake, try again, you can".

<h3>What should we change to improve the children's experience?</h3>

To improve children's experience with this new calculator program, we must adapt all the features of the program for children's users. Therefore, the buttons, the messages and everything related to this program must be suitable for their motor and brain development.

Therefore, it is considered that the message "User input deemed invalid" is not suitable for children because they may not understand this message or misinterpret it and desist from using the new program.

So, the most appropriate message to replace the previous message would be:

  • "You made a mistake, try again, you can"

Because this message is suitable for the friendly language that children use in their daily lives and they would better understand the message without giving up using the new program or the calculator.

Learn more about programs in: brainly.com/question/13264074

#SPJ1

3 0
2 years ago
Other questions:
  • 15. The text of a desktop publishing document is often created using
    6·2 answers
  • Mr. Green maintains a spreadsheet containing data on all of his employees, including name, job profile, monthly salary, and home
    15·1 answer
  • Give a recursive algorithm for finding the sum of the<br> first n odd positive integers.
    8·1 answer
  • Write a grammar for the language consisting of strings built only of the letters a and b. The strings may have any number of the
    6·1 answer
  • Nate wants to copy the style of his contact address to the normal template. Complete the paragraph to describe how he can access
    6·1 answer
  • You must configure a certificate authority on your network to use EFS. True or False?
    5·1 answer
  • Which terms would be found in search for "Mo*”? Check all that apply.
    8·1 answer
  • How many pages is 1500 words double spaced 12 font?.
    10·1 answer
  • Define a function Output Value() that takes two integer parameters and outputs the sum of all negative integers starting with th
    6·1 answer
  • A technique that was developed to determine whether a machine could or could not demonstrate the artificial intelligence known a
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!