Python: Create a copy of its own source code
Python Basic: Exercise-90 with Solution
Write a Python program to create a copy of its own source code.
print() print((lambda str='print(lambda str=%r: (str %% str))()': (str % str))()) print()
print(lambda str='print(lambda str=%r: (str %% str))()': (str % str))()
Visualize Python code execution:
The following tool visualize what the computer is doing step-by-step as it executes the said program:
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?