Official "Help me with my homework" thread

IndyDDR's online socialization center: general topics not related to specific coverage areas

Moderator: Moderators

User avatar
Merk
Lady Banned Son of Switzerland
Lady Banned Son of Switzerland
Posts: 8274
Joined: Wed Feb 02, 2005 9:33 am
Location: Bloomington / Ft. Wayne
Contact:

Official "Help me with my homework" thread

Post by Merk » Thu Sep 20, 2007 6:36 pm

I don't think we've ever done one of these before so let's give it a shot!

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
Perhaps I'm a dumbass, but don't know where to start. I THINK he wants us to have a string with a number concatenated onto it that represents the number of times the function has been called but I have absolutely no idea how to code that. Any help on this would be greatly appreciated.



I get bored at work (a lot) so let's post some difficult homework questions and learn some facts and shit! Knowledge is power!
Image

User avatar
danc1005
Heavy
Heavy
Posts: 3237
Joined: Tue Feb 28, 2006 7:21 pm
Location: Da Fort
Contact:

Post by danc1005 » Thu Sep 20, 2007 7:49 pm

You obviously just have to concatenate the string function makeFunc and add the argument to autogen.py and code it so that the multiple strings are returned in an argument for makeFunc.
Image

User avatar
Potter
Heavy
Heavy
Posts: 4856
Joined: Wed Feb 02, 2005 6:57 pm
Location: above the abyss
Contact:

Post by Potter » Thu Sep 20, 2007 9:12 pm

i really hope the above post was a joke
Riot wrote:My hair alone is like 5mb.
Merk wrote:Badyyyyy.. wanna go fiiiish? wanna go.... fiiiiIIIIIIIIIIIIsh?? Wanna go fishin'?!?!?! Him's a Badyyyy

User avatar
Fluffyumpkins
Moderator
Moderator
Posts: 6592
Joined: Wed Feb 02, 2005 1:53 pm

Post by Fluffyumpkins » Thu Sep 20, 2007 11:08 pm

I think you make a function that takes a string and writes it to a file. Do it 4 times in the same program so the file has 4 strings.

Also deport your professor.

User avatar
danc1005
Heavy
Heavy
Posts: 3237
Joined: Tue Feb 28, 2006 7:21 pm
Location: Da Fort
Contact:

Post by danc1005 » Fri Sep 21, 2007 5:20 pm

Potter wrote:i really hope the above post was a joke
duh
Image

User avatar
Merk
Lady Banned Son of Switzerland
Lady Banned Son of Switzerland
Posts: 8274
Joined: Wed Feb 02, 2005 9:33 am
Location: Bloomington / Ft. Wayne
Contact:

Post by Merk » Fri Sep 21, 2007 6:16 pm

Guys seriously this is due monday
Image

User avatar
Jeff Jeff Revolution
Heavy
Heavy
Posts: 1112
Joined: Sun Jun 18, 2006 12:33 pm
Location: New Palestine
Contact:

Post by Jeff Jeff Revolution » Fri Sep 21, 2007 9:24 pm

Anyone want to help me memorize all 212 of my play lines?
ShammerS wrote:Nice cookies, Jeff.
BigBadOrc wrote:boop
Fun fact: only 3 posts at IndyDDR.com contain the word "boop."

User avatar
BigBadOrc
Standard
Standard
Posts: 588
Joined: Mon Sep 04, 2006 8:53 pm
Location: Indy
Contact:

Post by BigBadOrc » Fri Sep 21, 2007 9:58 pm

Hm I forget how to code in python since i only used it for a few homework assignments myself so I'll write some javascript :D

Code: Select all

function makeFunc(str) {
  return "function " + str + "() { alert('" + str + "'); }";
}

function programLOLZ() {
   var funcName = "fname";
   for(var i=1;i<5;i++){
      writeToFile(makeFunc(funcName + i));
   }
   for(var(i=1;i<5;i++){
       writeToFile(funcName + i + "();\n");
   }
   runFile();
}
Yeah, i cheated a little since javascript doesn't have file I/O
groovestats
<3 blackcat

User avatar
chocobojoe
Heavy
Heavy
Posts: 2455
Joined: Wed Feb 02, 2005 1:43 pm
Location: Fort Wayne

Post by chocobojoe » Mon Sep 24, 2007 5:54 pm

to makeFunc you gotta get a black guy playing the slap bass and some other guy playing a guitar with wah-wah effect, then add some jazzy drums and maybe a trumpet or something, then another black guy singing some lead vocals about dancin and struttin.

User avatar
SoDeepPolaris
Heavy
Heavy
Posts: 2930
Joined: Wed Feb 02, 2005 5:55 pm
Location: dónde
Contact:

Post by SoDeepPolaris » Mon Sep 24, 2007 6:45 pm

Jeff Jeff Revolution wrote:Anyone want to help me memorize all 212 of my play lines?
MAYBE INSTEAD OF COUNTING THEM YOU SHOULD MEMORIZE THEM DURDURDURDURDURRRRRRRRRRRRRRRRRRRRRRRRRRRR.
I really love CS:GO's 64 tick servers.

elcuebee
Standard
Standard
Posts: 507
Joined: Sun Jun 12, 2005 11:45 pm

Post by elcuebee » Mon Sep 24, 2007 7:56 pm

TAZO TEA

User avatar
blackcat
Heavy
Heavy
Posts: 1224
Joined: Sun Mar 19, 2006 9:05 pm
Location: Bloomington/Carmel
Contact:

Post by blackcat » Mon Sep 24, 2007 9:13 pm

SoDeepPolaris wrote:
Jeff Jeff Revolution wrote:Anyone want to help me memorize all 212 of my play lines?
MAYBE INSTEAD OF COUNTING THEM YOU SHOULD MEMORIZE THEM DURDURDURDURDURRRRRRRRRRRRRRRRRRRRRRRRRRRR.
:x

I'll help you if you need it Jeff.

User avatar
Jeff Jeff Revolution
Heavy
Heavy
Posts: 1112
Joined: Sun Jun 18, 2006 12:33 pm
Location: New Palestine
Contact:

Post by Jeff Jeff Revolution » Mon Sep 24, 2007 9:38 pm

SoDeepPolaris wrote:
Jeff Jeff Revolution wrote:Anyone want to help me memorize all 212 of my play lines?
MAYBE INSTEAD OF COUNTING THEM YOU SHOULD MEMORIZE THEM DURDURDURDURDURRRRRRRRRRRRRRRRRRRRRRRRRRRR.
It says in the beginning of the script exactly how many I have.

Also, thanks Katy, but the odds of you and I sitting down and practicing on an Indy Groove night are astronomical. I see an ITG machine, all thoughts go out the window.
ShammerS wrote:Nice cookies, Jeff.
BigBadOrc wrote:boop
Fun fact: only 3 posts at IndyDDR.com contain the word "boop."

User avatar
TaQa
Standard
Standard
Posts: 435
Joined: Wed Feb 02, 2005 1:33 pm
Contact:

Post by TaQa » Mon Sep 24, 2007 9:51 pm

I've got a problem from my Real Analysis class. I'm sure I can figure it out, I'm just lazy. But here it is:

Prove the closed ball is closed.

Yeah, sounds stupid, but we're supposed to use Cauchy sequences along with the good ol' epsilon delta garbage to prove it.
Image

User avatar
BigBadOrc
Standard
Standard
Posts: 588
Joined: Mon Sep 04, 2006 8:53 pm
Location: Indy
Contact:

Post by BigBadOrc » Mon Sep 24, 2007 11:21 pm

TaQa wrote: Prove the closed ball is closed.
FILL WITH WATER SEE IF IT LEAKS LOLZ
groovestats
<3 blackcat

Post Reply