string = "if X > 3 :\n print(\"X is Greater\")\nelse :\n print(\"X is Lesser\")"
""" It prints the string as an indented code of if else statements if X is greater than 3
X is greater else it prints X is lesser"""
X = 6
eval(string)
Can eval()
in python be used in this way or is there anything I'm missing .