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
Icons, arrows, shapes, and lines are considered what type of graphics?
monitta

Answer:

c I have took this test hefore

7 0
4 years ago
Write an INSERT statement that adds this row to the Categories table: category_name: Brass Code the INSERT statement so MySQL au
nexus9112 [7]

Answer:

Query:

insert into Categories (category_name) values ('Brass Code');

Explanation:

  • The query is a medium through which a user of the database can communicate with the database or tables or any particular data. It means that when a user wants to access the database or tables or any data then there is a medium of query which is also known as SQL query.
  • The query can help to make the database(which is a collection of tables), make the table in the database, add the data, modify the data or delete the data.
  • For add the data there is a insert query which syntax is as follows: insert into table_name (column_1_name,column_2_name,....,column_n_name) values (column_1_values,column_2_values,....,column_n_values);
  • There is only one column value in the question which a user needs to add so that can be done by the help of a statement that is defined on the answer part.
5 0
4 years ago
Write an algorithm to find the average of three numbers: 10, 20, 30
STALIN [3.7K]

Language: JavaScript

Answer:

let num = [10,20,30];

average(num);  

function average(num) {

 let sum = 0;

 for(let i in num) {

   sum += num[i];

 }  

 return console.log(sum/num.length);

}

3 0
3 years ago
The __________ process is designed to find and document vulnerabilities that may be present because there are misconfigured syst
Roman55 [17]

answer.

I don't know what it is

8 0
2 years ago
2560x1600 (apple)vs 1920x1200 (Dell), is there a big difference between those 2 based on screen resolution ? ​
Solnce55 [7]

Answer:

Yes

Explanation:

1920x1200 is a non-standard resolution which may not be fully supported, usually 1920x1080 (1080p) is preferred and has been standardised as a display resolution.

2560x1600 (WQXGA) is a more standardised display resolution, and will offer a lot sharper and crisper images as more pixels are being used to render the image. As a rule of thumb, the higher resolution - the better.

The difference between these two resolutions is about the same difference as 1080p and 2k, you are going to get twice as crisp an image.

However there are other factors, such as refresh rate that may come into play with a comparison with these two.

3 0
4 years ago
Other questions:
  • Which statement about word processing software is true? A)You can use it to perform mathematical calculations.B) You can use it
    6·2 answers
  • You've been asked to design a soho network on a work place. the other offices in the building also have wireless networks. while
    7·1 answer
  • Tristan has moved the Television and related equipment
    10·1 answer
  • Riley is using access to collect data for a science project. he is creating a report and wants to apply predefined color and fon
    6·1 answer
  • <img src="https://tex.z-dn.net/?f=1%20%5Ctimes%202" id="TexFormula1" title="1 \times 2" alt="1 \times 2" align="absmiddle" class
    11·2 answers
  • [15 points] 3.2 Lesson Practice (holy marry mother of joseph)
    7·1 answer
  • _____emphasizes on proper breathing and the mind-body-spirit connections.​
    6·2 answers
  • NEED HELP
    9·1 answer
  • Write a recursive method that takes four inputs: a 1-D array of Strings (i.e., exams), the length of this 1-D array (i.e., n), a
    8·1 answer
  • I am a non-volatile type of built-in memory. I store my contents long-term. My job is to store critical programs that the comput
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!