subject

The compare_strings function is supposed to compare just the alphanumeric content of two strings, ignoring upper vs lower case and punctuation. But something is not working. Fill in the code to try to find the problems, then fix the problems. import re
def compare_strings(string1, string2):
#Convert both strings to lowercase
#and remove leading and trailing blanks
string1 = string1.lower().strip()
string2 = string2.lower().strip()

#Ignore punctuation
punctuation = r"[.?!,;:-']"
string1 = re. sub(punctuation, r"", string1)
string2 = re. sub(punctuation, r"", string2)

#DEBUG CODE GOES HERE
print(___)

return string1 == string2

print(compare_strings("Have a Great Day!", "Have a great day?")) # True
print(compare_strings("It's raining again.", "its raining, again")) # True
print(compare_strings("Learn to count: 1, 2, 3.", "Learn to count: one, two, three.")) # False
print(compare_strings("They found some body.", "They found somebody.")) # False

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:20
Cengagenowv2 is a comprehensive online learning tool. using cengagenowv2, you may access all of the following except: 2. each time you log in, cengagenowv2 automatically performs a system check and informs you if your computer does not meet the cengagenowv2 system requirements. 3. which tab/page allows you to easily track your assignment scores, number of submissions, time spent, as well as the ability view assign
Answers: 3
question
Computers and Technology, 24.06.2019 03:30
The footer area of a web page generally houses which website feature? terms of use web page content business name or title menu headings
Answers: 1
question
Computers and Technology, 24.06.2019 17:00
Carlos, an algebra teacher, is creating a series of powerpoint presentations to use during class lectures. after writing, formatting, and stylizing the first presentation, he would like to begin writing the next presentation. he plans to insert all-new content, but he wants to have the same formatting and style as in the first one. what would be the most efficient way for carlos to begin creating the new presentation? going under the file tab and opening the first presentation, deleting all content from each page, and adding new content going under the file tab and clicking on new in the left pane, then choosing new from existing going under the design tab and clicking on themes, then selecting the theme that was used for the first template going under the design tab and opening the template that was created for the first presentation
Answers: 2
question
Computers and Technology, 24.06.2019 18:20
The following if statement contains a logic error, not a syntax error. rewrite it so that it is correct. assume the variable age already exists and holds a valid number. if (age == 18 & & age == 19) {
Answers: 1
You know the right answer?
The compare_strings function is supposed to compare just the alphanumeric content of two strings, ig...
Questions
question
Mathematics, 19.04.2020 04:27
question
Physics, 19.04.2020 04:28
Questions on the website: 13722359