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]
2 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]2 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
This type of method method performs a task and sends a value back to the code that called it:
Thepotemich [5.8K]

Answer:

Option 4: Value-returning

Explanation:

In programming, a method is a named section of codes that perform a specific task. This is possible to define a method that return a value after performing its task. This type of method is known as Value-returning method.

For example, we can define a method addition that takes two inputs, x, y and return the summation of x + y to the code that called it. The codes are as follows:

  1.    public static void main(String[] args) {
  2.        int sum = addition(3, 5);
  3.    }
  4.    
  5.    public static int addition(int x, int y){
  6.        return x + y;
  7.    }

6 0
3 years ago
Write a program named split_me.py that accepts a string in the format Age.FirstName and returns the value FirstName is Age years
zmey [24]

age,name = input('Enter a string: ').split('.')

print(name+' is '+age+' years old. Length of '+name+' is '+str(len(name)))

I wrote my code in python 3.8. I hope this helps.

5 0
3 years ago
How do users log into Windows 8?
bogdanovich [222]
I think it’s swipe up if i’m correct, if not sorry
5 0
3 years ago
How many generations of computer languages have there been since the middle of the 20th century?
evablogger [386]
4 generations hahahaha
3 0
2 years ago
Read 2 more answers
DO NOT ANSWER FOR JUST POINTS
Elza [17]

Answer:

E.

a medium dashed line

Explanation:

I always use medium hehe so I think that'll work.

5 0
2 years ago
Read 2 more answers
Other questions:
  • What is the last step in conducting url search
    11·1 answer
  • A user can easily moved to the end of document by pressing what key combination?
    8·2 answers
  • Sam has installed a new CPU in a client’s computer, but nothing happens when he pushes the power button on the case. The LED on
    14·1 answer
  • Design and implement an application that reads a sequence of up to 25 pairs of names and postal (ZIP) codes for individuals. Sto
    9·1 answer
  • What is one of the benefits of using templates for your email marketing campaigns?
    10·1 answer
  • What’s the answer to this question?
    15·1 answer
  • What is qwerty and why is it on the keyboard?
    15·2 answers
  • It is impossible to use a computer without a mouse. Is this statement true or false?
    10·1 answer
  • What can handle work that is hard on a person and could cause repetitive injuries?
    6·1 answer
  • The ________ function will change a character argument from lowercase to uppercase. isupper toupper tolarge fromlower none of th
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!