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
Alex787 [66]
3 years ago
12

Write a function check_palindrome that takes a string as an input and within that function determines whether the input string i

s a palindrome or not (a word or phrase that is read the same forward as it is backward - i.e. kayak, dad, etc.). If it is a palindrome, return 'Hey! That's a palindrome!' If it is not a palindrome, return 'Bummer. Not a palindrome.' Remember that you created a function that can reverse a string above.
Computers and Technology
1 answer:
Setler79 [48]3 years ago
3 0

Answer:

The function in Python is as follows:

def check_palindrome(strn):

   retstr = "Bummer. Not a palindrome."

   if strn[len(strn)::-1] ==strn:

       retstr = "Hey! That's a palindrome!"

       

   return retstr

Explanation:

This defines the function

def check_palindrome(strn):

This sets the return string to not a palindrome

   retstr = "Bummer. Not a palindrome."

This checks if the original string and the reversed string are the same

   if strn[len(strn)::-1] ==strn:

If yes, the return string is set to palindrome

       retstr = "Hey! That's a palindrome!"

This returns the expected string

   return retstr

<em>The function to reverse the string is not given; and the programming language. So, I solve the question without considering any function</em>

You might be interested in
________ returns the last character in a StringBuilder variable named strBuf? Select one: A. strBuf.charAt(strBuf.length() - 1)
Lunna [17]

Answer:

A

Explanation:

strBuf.charAt(strBuf.length() - 1)

4 0
3 years ago
.Write a MATLAB script that VECTORIZES (eliminates the loop) the following code. (4points)
gladu [14]

Answer:

Explanation:

try

clc

clear

close all

x=linspace(0,2*pi,7);

z=cos(pi.*x./3)

% the output on mine is to 4 decimals so it looks a bit different than what the output on your example is , but, I think if you change the format to decimal 2 it will look the same  :)

4 0
2 years ago
Why might you need to convert a file to another file type
Alex17521 [72]
This depends on what program you're using. Some programs can only read certain files exclusive to that program, such as .psd files can usually only be read in Photoshop or other adobe programs. Many fields of work (Journalism, the Arts, Design, etc.) ask for .psd files to be converted to either .png, .jpg, or .tiff so that it can be seen on many other platforms.

For images especially, files are more compatible either on a program or printed. for example, .png files are good for storing color data from computer to computer, but if you print a .png file, the quality is poor. hence it's recommended to save files you want to print for designs as .jpeg, because .jpeg can more easily be printed and will then be presented at a high quality.

Sometimes color quality changes depending on CMYK as well but that's a whole other ball of wax.
8 0
3 years ago
You wrote a program to allow the user to guess a number. Complete the code to generate a random integer from one to 10.
just olya [345]

Answer:

randint

Explanation:

Just did my quiz and got a 100%

7 0
3 years ago
Read 2 more answers
What is cpu write its parts<br>​
aev [14]

Answer:  a CPU is a central processing unit. They’re responsible for creating and executing instructionsl

Explanation:

6 0
2 years ago
Other questions:
  • Only the _________ can add users with passwords and limit user access to selected areas.
    5·1 answer
  • Unlike artistic drawings, which communicate self-expression and
    15·1 answer
  • Describe an ergonomic consideration for your body while working for long periods in front of a monitor or computer screen?
    14·1 answer
  • A(n) ________ is a special value that cannot be mistaken as a member of a list of data items and signals that there are no more
    9·1 answer
  • 1- Which of the following is the java keyword used to declare a class?
    5·2 answers
  • What are lexical errors?<br> and fi(a==b)<br> will it be a lexical error or a syntactical error?
    8·1 answer
  • Which is an example of an incremental approach to solving a problem?
    15·1 answer
  • Describe the process of normalization and why it is needed.
    12·1 answer
  • Question 4 A data analyst wants to include a line of code directly in their .rmd file in order to explain their process more cle
    10·1 answer
  • _____ oversee the work of various types of computer professionals and must be able to communicate with people in technical and n
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!