[Tutor] 'elp!!!!!!!1Totally Clueless Newbie In Distress
Karl Wittgenstein
miago.python at gmail.com
Fri Jan 19 14:19:24 CET 2007
Dear Smart Caring Dude,
I've been dabbling into Python for about 6 weeks now.I'm a Social Sciences
student who just got interested in programming and chose Python as first
language.I have little time to practice and I am just getting into
programming concepts,so please be patient,in case you are so kind as to
enlighten this poor soul.
I am trying to write this program which should compare values that are set
by the program through user's choice to values that the user enters on a
prompt.I use SPE on windows xp,and it tells me that there are indentation
erros on the definitions.Isn't it legal to start a new block of code when
starting a definition?And how come it returns 'variable' not defined,when
they are defined by the = ??Should i make them global?
I would be very grateful to the patient soul that answers these questions,as
my learning interest is sincere and the knowledge sources so disperse.
Here goes the code:
#Ok,this is supposed to be a 2 option choice between values 1 and 4,
#i want the value to determine the variable values inside the function
def porao():
porao = raw_input()
if porao == 1 :
global altura_aeronave = 111
global largura_aeronave = 112
global comprimento = 211
elif porao == 4:
global altura_aeronave = 112
global largura_aeronave = 113
global comprimento = 212
else:
print "PorĂ£o inexistente"
#These three functions were supposed to get input from user so it can be
compared
#with the values determinated(determined?)above
def largura():
global largura=input()
def altura():
global altura=input()
def comprimento():
global comprimento = input()
#These are the comparison functions
def largura_compativel ():
if not largura <= largura_aeronave:
print 'Volume largo demais!'
def altura_compativel ():
if not altura <= altura_aeronave:
print 'Volume alto demais!'
def comprimento_compativel ():
if not comprimento<=comprimento_aeronave:
print 'Volume comprido demais!'
#Try to run this damn thing,man!!!!!1
porao()
largura()
altura()
comprimento()
largura_compativel()
altura_compativel
comprimento_compativel()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070119/12b6f0d9/attachment.htm
More information about the Tutor
mailing list