Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Introductory Python course - need help. Please be simple with your functions. A

ID: 3863721 • Letter: I

Question

Introductory Python course - need help. Please be simple with your functions.

A palindrome is a word, phrase, or sequence that reads the same backward as forward. For example, madam is a palindrome. As another example, nurses run is a palindrome. Now we are ready to write the final function of the assignment. Remember to switch roles for function #5 (and specify who is acting in which role). Write a function that takes, as an argument, a string, and returns the Boolean True if it is a palindrome, and False if it is not. Name your function palindrome(myString). In this case, there may be spaces that do not need to line up, as in the example "nurses run". For example, >>>palindrome("madam") should return True, and >>>palindrome("hello") should return False.

Explanation / Answer

def palindrome(myString):

alphabet = list(myString)
palindrome = True

for alphabet in alphabets:
if alphabet == alphabets[-1]:
alphabets.pop(-1)
else:
palindrome = False
break

return palindrome

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote