subject

Consider the following segment of code, which prompts the user for a string of lowercase characters (no capitals, spaces, digits, or punctuation) and prints True if the string is palindrome and false otherwise. This implementation is recursive and uses a deque. Because the user expects to provide a string instead of a deque instance, we use a wrapper function. The user calls is_palindrome and provides a string. is_palindrome forms a deque with the contents of the string and sends the deque object to the recursive rec_palindrome function. Both functions return Boolean values. Be sure not to include any unnecessary spaces in your answers. For example, keywords like and and or need spaces around them. Operators such as== as and < do not.

from Deque_Generator import get _deque
def rec palindrome (dq): if return else:
if
return
else:
return

def is_palindrome (character_string)
dq-get_dequeO
for c in character_string:

return

print(is_palindrome (input ("Enter a phrase of lowercase characters only: ")))

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:30
Advantages and disadvantages of binary system
Answers: 1
question
Computers and Technology, 22.06.2019 05:00
Are special characters that allow you to search for multiple words at the same time.
Answers: 2
question
Computers and Technology, 23.06.2019 10:30
Would a ps4 wired controller work on an xbox one
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
Where can page numbers appear? check all that apply. in the header inside tables in the footer at the bottom of columns at the top of columns
Answers: 1
You know the right answer?
Consider the following segment of code, which prompts the user for a string of lowercase characters...
Questions
Questions on the website: 13722367