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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:30
How will you cite information that is common knowledge in your research paper?
Answers: 1
question
Computers and Technology, 22.06.2019 10:00
Which of the following is true of operations within a spreadsheet program’s built-in functions? a. operations within parentheses, then multiplication and division, and then addition and subtraction are computed. b. operations within parentheses, then addition and subtraction, and then multiplication and division are computed. c. multiplication and division, then addition and subtraction, and then operations within parentheses are computed. d. addition and subtraction, then multiplication and division, and then operations within parentheses are computed
Answers: 2
question
Computers and Technology, 23.06.2019 03:30
Many everyday occurrences can be represented as a binary bit. for example, a door is open or closed, the stove is on or off, and the fog is asleep or awake. could relationships be represented as a binary value? give example.
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
What is one reason why indoor air pollution has become an increasing problem.
Answers: 1
You know the right answer?
The transform_comments function converts comments in a Python script into those usable by a C compil...
Questions
question
Chemistry, 29.08.2019 18:00
question
Mathematics, 29.08.2019 18:00
question
Chemistry, 29.08.2019 18:00
Questions on the website: 13722362