Exam GPYC All QuestionsBrowse all questions from this exam
Question 23

What is the output when the following commands are typed in Python interactive mode?

    Correct Answer: D

    The output of the command re.findall(r"tag.*tag", "i want tag to go tag to sans tag") in Python is ['tag to go tag to sans tag']. The regular expression r"tag.*tag" matches the shortest string that starts with "tag" and ends with "tag", including everything in between. In this case, the entire substring "tag to go tag to sans tag" is matched.

Discussion
bighead12Option: D

D. I ran the code :)

matts5150Option: D

ran code

NASCAROption: D

Answer is D. There isn't a comma in the string either. Python confirms this.

k4ziOption: D

Yeah thought it was wrong and confirmed as bighead12 did. The answer is D.

a29dc2cOption: D

D is the answer