Sat Apr 19 18:09:01 2003
Following Magnus' lead I thought we could at least make an interesting
thread out of this. Having look at the questions I am a bit worried about
the level of competence expected at this university so it might be an idea
to forward it to the appropriate education list with the subject: are these
questions appropriate for university education?
The results could go to Useless Python to make the site really worthy of
> >1>Which of the following Python statements is NOT used
> >for flow control.
> >a> a,b = 0,1
> >b> if x < 0:
> >c> while b< 1000:
> >d> for x in a:
> Neither. You use pipes and faucets etc for flow control. These are all
> programming constructs.
1) The amount you drink
2) Availability of amenities
3) Bladder muscles (can be trained)
4) Pampers (if all else fails)
> >2>What output will the following string parsing code
> >mystring="the quick brown fox jumped over the lazy dog"
> >print left(mystring,instr(mystring,"fox")-1)
Is this Python? Oh my, I thought it was easier than that!
Answer: it doesn't matter 'cos the fox lands in some very sticky mud.
Counterquestion: is this actually parsing? I don't have a definition to
hand but just combining two functions doesn't really seem like parsing. Any
-5 for illegibility.
> >3>What is the principle purpose of a python cgi
> >a> to process the contents of an HTML page
> >b> to generate forms containing name/value
> >querystrings or form variables
> >c>to process in a Python script Name/Value pairs from
> >an HTML form or query string
> >d>to dynamically create HTML
> Neither. The purpose of the cgi module is to make life easier for cgi
Good answer, Magnus, but note the question refers to _a_ python cgi module.
Maybe there are others? Just imagine a Python cgi module that emulated
perl's cgi handling?
Or it might be a trick question?
"There should be one and preferably only one obvious way of doing things."
Or so I've heard said.
> >4>A scripting language is generally,
> >a> Interpretive
> >b> Used to build complex applications
> >c> Fast and efficient
> >d> Loosely typed
> All of the above, slightly depending on *what* you want to be fast and
> efficient. (Your work or the computers.)
Anything apart from "c" would be equally applicable to literary (or medial)
criticism or even production. Imagine Shakespearean drama written in Python:
b = rawinput("is it nobler in the mind to suffer the slings and arrow of
outrageous fortune Or to take arms against a sea of troubles?")
if b or not b:
Hamlet(king=kill, sister=kill, everybody=kill)
NB. this is untested and probably won't work but imagine we're on the verge
of a whole new discipline!
"once more into the breach my friends!"
while not dead:
"is this a dagger I see before me?"
if item instance(Dagger):
"Now is the winter of our discontent"
now = time.shakespeare("Richard III")