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, 21.06.2019 20:50
Write a method in the heapintpriorityqueue class called merge that accepts another heapintpriorityqueue as a parameter and adds all elements from the other queue into the current queue, maintaining proper heap order such that the elements will still come out in ascending order when they are removed. your code should not modify the queue passed in as a parameter. (recall that objects of the same class can access each other's private fields.)
Answers: 2
question
Computers and Technology, 22.06.2019 15:20
This os integrated the processing power of windows nt with the easy-to-use gui of windows 98. windows 2000 windows 3.11 windows for workgroups windowa millennium edition
Answers: 1
question
Computers and Technology, 24.06.2019 06:50
What are the things you are considering before uploading photos on social media?
Answers: 1
question
Computers and Technology, 24.06.2019 19:20
Kiesha has a worksheet with a range of cells using the following columns: name, score, group, study group, and date. kiesha needs to sort the worksheet on the date field. which option she use to most efficiently complete this task ? a use the cut and paste option to reorganize the data to fit that order b use the filter function to organize the data based on the date c use the order function to organize the data based on the date d use the sort function to organize the data based on date order
Answers: 3
You know the right answer?
Consider the following segment of code, which prompts the user for a string of lowercase characters...
Questions
question
English, 21.01.2021 23:10
question
Mathematics, 21.01.2021 23:10
question
History, 21.01.2021 23:10
question
Health, 21.01.2021 23:10
Questions on the website: 13722362