Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1. Write a function (5 points) Write a function reverse_word(word) that takes a word and returns the word backwards. The function should work with

image text in transcribed

Problem 1. Write a function (5 points) Write a function reverse_word(word) that takes a word and returns the word backwards. The function should work with the following code: \[ \begin{array}{l} \text { if __-name__=_ '_-main_' : } \\ \text { backward_word = reverse_word('hello') } \\ \text { assert backward_word == 'olleh' } \\ \text { backward_word = reverse_word ('madam') } \\ \text { assert backward_word == 'madam' } \end{array} \] Name your file backwards.py and upload it here. Problem 2. Write a function (5 points) A palindrome is a word, phrase, or sequence that reads the same backward as forward. Write a function is_palindrome that verifies if a word is a palindrome. The function should work with the following code: \[ \begin{array}{l} \text { if __name__== '_-main_' } \\ \text { assert is_palindrome ('madam' })==\text { True } \\ \text { assert is_palindrome ('hello' } \left.{ }^{\prime} ight)==\text { False } \\ \end{array} \] Name your file palindrome.py and upload it here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions