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 14:50
Drag each label to the correct location on the image list the do’s and don’ts of safeguarding your password. a. keep yourself logged in when you leave your computer.b. don’t write your password down and leave it where others can find it.c. share your password with your friends.d.each time you visit a website,retain the cookies on your computer.e. use a long password with mixed characters.1. do's 2. don'ts
Answers: 2
question
Computers and Technology, 23.06.2019 12:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
Answers: 1
question
Computers and Technology, 24.06.2019 02:30
Write the pseudo code for this problem based on what you learned from the video. the purpose is to design a modular program that asks the user to enter a distance in kilometers, and then converts that distance to miles. the conversion formula is as follows: miles = kilometers x 0.6214
Answers: 3
question
Computers and Technology, 24.06.2019 16:00
Which of the following characters is acceptable to use in a filename? ? / – %
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: 13722360