subject

The transform_comments function converts comments in a Python script into those usable by a C compiler. This means looking for text that begins with a hash mark (#) and replacing it with double slashes (/), which is the single-line comment indicator. For the purpose of this exercise, we'll ignore the possibility of a hash mark embedded inside of a Python command, and assume that it's only used to indicate a comment. We also want to treat repetitive hash marks (##), (###), etc., as a single comment indicator, to be replaced with just (//) and not (#/) or (1/#). Fill in the parameters of the substitution method to complete this function: 4 1 import re 2 - def transform_comments (line_of_code): 3 result = re. sub (_) return result 5 6 print(transform_comments("### Start of program")) 7 # Should be "// Start of program" 8 print(transform_comments(" number = 0 ## Initialize the variable")) 9 # Should be number = 0 // Initialize the variable" 10 print(transform_comments(" number += 1 # Increment the variable")) 11 # Should be " number += 1 // Increment the variable" 12 print(transform_comments("return(nu mber)")) 13 # Should be return(number)" Run Reset

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, Angelanova69134
Technician a says that a shop towel should never be used to clean around the flange area before replacing an automatic transmission filter. technician b says that a dimpled transmission fluid pan can be repaired. who is right
Answers: 3
image
Computers and Technology, 23.06.2019 11:00, jaygamer37
What is the name of the sound effect that danny hears
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, powellmj9216
Spoons are designed to be used for: spring hammering. applying body filler. identifying high and low spots. sanding highly formed areas.
Answers: 3
image
Computers and Technology, 24.06.2019 00:20, danielmartinez024m
The guy wire bd exerts on the telephone pole ac a force p directed along bd. knowing the p must have a 720-n component perpendicular to the pole ac, determine the magnitude of force p and its component along line ac.
Answers: 2
You know the right answer?
The transform_comments function converts comments in a Python script into those usable by a C compil...

Questions in other subjects:

Konu
Biology, 06.08.2021 06:00
Konu
Mathematics, 06.08.2021 06:00
Konu
Social Studies, 06.08.2021 06:00
Konu
English, 06.08.2021 06:00
Konu
Mathematics, 06.08.2021 06:00