Apr-18-2021, 07:33 PM
Hi
I'm modifying a code by moving an "exec" inside a function creating an error; I wrote a small code highlighting what I'm facing.
What I'm missing and what is the correct programming ?
Thanks
What I'm missing
I'm modifying a code by moving an "exec" inside a function creating an error; I wrote a small code highlighting what I'm facing.
What I'm missing and what is the correct programming ?
Thanks
What I'm missing
Sentence = "World is " print("without using a function") Add0 = 'beautifull' exec("New0 = Sentence + '%s'" %Add0) print("\t- Complete sentence 0 = {}".format(New0)) print("\nUsing a function") def Complete(Part): Add = 'beautifull' exec("New = Part + '%s'" %Add) print("\t- Complete sentence 1 = {}".format(New)) print("\t- Complete sentence 2 = %s" %(New)) Complete(Sentence)