answersLogoWhite

0


Best Answer

def isPalindrome(s): return s == s[::-1]

then just call the function with a string like

isPalindrome('poop')

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Using Python write an algorithm that takes a string as input and determines whether or not it is a palindrome?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you use the longest Prefix Match algorithm in C programming?

You can use the longest Prefix Match algorithm in C programming by looking up the longest standard Python package match and then converting that from Python into C or C++ to figure out how to create the equivalent.


How do you write a function in Python to calculate the perimeter of a regular polygon of N sides and use that to approximate Pi by increasing N until Pi?

You can find a description of the algorithm in the Wikipedia article titled "Liu Hui's π algorithm".


What is the Python algorithm in linear least square?

p.begin_fill()p.circle(60)p.end_fill()p.begin_fill()for i in range(4):p.fd(60)p.rt(90)p.end_fill()


What is a Python that starts with the letter R?

Reticulated Python


How does a PYTHON protect itself from danger?

It depends on the species of python. for example the Python Molurus will attack if threatened and will fight to the death! http://en.wikipedia.org/wiki/Python_molurus The Python Curtis Probably wouldn't defend it self, and because of this they can be used as pets. http://en.wikipedia.org/wiki/Python_curtus But the most common way for a python to defend itself would be to lunge and bite. and even then it usually varies between species on whether it would, continue biting, hold on, or run away after.


How a python reproduces?

In a python


What is a boa or a python?

a python


Is python required on a computer?

Python is in no way required on a Microsoft or Apple operating system. Python is a programming language/interpreter and is just an addon. Python, a computational language, like Java/C++, is not required to operate a computer. It is solely a shell and language combination that programmers might use to write code/ algorithms in a simpler language than Java. You do not need it unless you want to use for coding or learning computational function construction. Your computer will not be affected by whether or not you have Python, (the latest version is 3.0).


Is there such thing as a bull python?

The ball python is only one type of Python. As I don't know which other type of python you're asking me to compare the ball python with I can't really answer your question...


How many times a year does a python lay eggs?

It depends how old the python is, and whether it's completely healthy or not. The average healthy three-year old python lays eggs two to three times a year... if it were any more, they would most likely die of exhaustion. Their muscles would weaken, therefore making them unable to coil.


What is ball python in latin?

Python Regius, which translates to "Royal Python," its original name.


What is the Indian python's scientific name?

The scientific name of the Indian python is Python molurus.