Created
March 12, 2022 17:14
-
-
Save Codehunter-py/d264e146e371b1dd2ef273275223899a to your computer and use it in GitHub Desktop.
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 C single-line comment indicator. For the purpose of this exercise, we'll ignore the possibility of a hash mark embedded inside…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just go ahead with re.sub(r'#+", r"//", line_of_code)