(no subject)
Sep. 23rd, 2007 06:43 pmOh god, I loath my programing class.
Case in point? "I shall explain what I want you to do with an If-then statement, but you can't actually use an if-then statement in the program. But you can use a list!"
...What the hell? Seriously.
At least my AI that leads the laboratory section knows how to program python.
Case in point? "I shall explain what I want you to do with an If-then statement, but you can't actually use an if-then statement in the program. But you can use a list!"
...What the hell? Seriously.
At least my AI that leads the laboratory section knows how to program python.
no subject
Date: 2007-09-24 12:11 am (UTC)no subject
Date: 2007-09-24 12:27 am (UTC)Except, the entire class is shoddy programmers, and the professor has never taught before and he's going though python at warp speed because, obviously, C is so much like python that we should have no problem picking this stuff up, right?
And, of course, all the examples that he gives us of code aren't in Idle? So the syntax is completely different.
The problem, in this case, is: Write three functions called X, Y and Z. Each one should take a single number. For function X, it should add 1 to its argument and return the value. For function Y, it should add 2 to the argument and return the value. And for function Z, it should add 3 and return the value. Then write a program that will call X or Y or Z with the number 4 and prints the result. Exactly which function is called is determined by a variable F. If F is 1, call X. If F is 2 call Y and if F is 3 call Z. However, your program must not use an if statement! Thus if we run the program with F = 1, the output should be 5 and so on. Your program should first set F = 1 and call the appropriate function, then set F = 2 call the appropriate function and then set F = 3 and call the appropriate function. Hint - use a list.
The website is here (http://cheminfo.informatics.indiana.edu/~rguha/class/2007/i211/).
It's all very rage inducing.
Though I did manage to amuse the lab last Friday when I started a war with Python, bitching at the computer and talking myself until I won the code war - and then I realized that I didn't win at all and did a faceplant into the keyboard. But I did get the AI's attention, got a laugh out of the lab, and got my code fixed, so whats a few SAN points?
Considers a Perl icon again
Date: 2007-09-24 12:36 am (UTC)But I'm all for a war against Python. Did I ever tell you why I hate Python?
Re: Considers a Perl icon again
Date: 2007-09-24 01:01 am (UTC)No, why do you hate Python? Oddly enough, the language they taught in this class before was Perl. The instructor thought that python was an easier language to deal with.
Re: Considers a Perl icon again
Date: 2007-09-24 01:23 am (UTC)The second one first. I looked up the happy, preferred way to break up web page. Web scraping is what I do, so when I learn a new language, "how do I download something from the web?" and "how do I break up the HTML?" are my first questions. And, as it turned out, the preferred way was HTML as a stream. I found that to be mind-numbingly stupid way of handling the issue, coming from the world of Perl REGEX.
And second, white space matters to the compiler. White space is important. White space is good. It separates things that should be separated. Notice the paragraph separation here. But, when white space is important, white space can burn you.
TABpython code hereTABpython code here
SPACETABpython code here
TABpython code here
Can you see where the bug in this code would be? And, if, instead of words, there were real spaces and tabs, how long would it take for you to identify the problem? For me? I think it was the better part of an hour.
Re: Considers a Perl icon again
Date: 2007-09-24 10:16 pm (UTC)no subject
Date: 2007-09-25 03:50 am (UTC)