I'm learning Python right now in one of my classes, it's a pretty simple language in terms of flexibility and syntax but god damn does my instructor go out of his way to word problems in the most obscure and ambiguous way ever. English is his second language and I can expect some errors here and there, but I have no idea what he's asking in this problem:
Code: Select all
Write a function called makeFunc taking a single string argument that will create and return a string. The return string will contain the text of a Python function (which will not take any arguments) whose name is the argument mentioned above and will simply print out this argument.
Write a program that calls makeFunc 4 times, each time passing to it an argument of the form 'fname1', 'fname2' etc. (So the first time you send it 'fname1' and so on). Each time you call makeFunc you'll get back the string. Write these strings to a file called autogen.py. Finally your program should add to autogen.py the code to call the functions you just generated.
After you run your program, you should have a file called autogen.py which if you then run should output
fname1
fname2
fname3
fname4
I get bored at work (a lot) so let's post some difficult homework questions and learn some facts and shit! Knowledge is power!