# 'elp!!!!!!!1Totally Clueless Newbie In Distress

19 messages
Open this post in threaded view
|

## 'elp!!!!!!!1Totally Clueless Newbie In Distress

 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 functiondef 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?)abovedef largura():   global largura=input() def altura():   global altura=input()def comprimento():   global comprimento = input()#These are the comparison functionsdef 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!!!!!1porao()largura()altura()comprimento()largura_compativel()altura_compativelcomprimento_compativel()   _______________________________________________ Tutor maillist  -  [hidden email] http://mail.python.org/mailman/listinfo/tutor
Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

 In reply to this post by Karl Wittgenstein Karl Wittgenstein wrote: > Thank you again,and once more in advance - if you would be so kind as to > point me learning material...My spare time is very short,between > graduation and work,so I would appreciate very didatic material...Thank > you guys again! Try one of the tutorials listed here http://wiki.python.org/moin/BeginnersGuide/NonProgrammersor one of these books: http://effbot.org/pyfaq/tutor-what-are-some-good-books-on-python.htmKent _______________________________________________ Tutor maillist  -  [hidden email] http://mail.python.org/mailman/listinfo/tutor
Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

 In reply to this post by Karl Wittgenstein Karl Wittgenstein wrote: > I would also like to ask what skills you think I should develop so I can > approach programming more             > ' natively', and would like to clarify the following issue: > input("Something") usually displays Something when prompting for > input;why is that the case when I run a single line of code and isn't > when I use many?When I run three lines straight in this format,only the > first message and prompt are displayed...That is surely out of the scope > of my current knowledge....Which is not very encompassing,anyway. input('Something') displays the prompt 'Something' and then waits for input up to a new line. When you enter the input it will execute the next statement which may be another input(). Kent _______________________________________________ Tutor maillist  -  [hidden email] http://mail.python.org/mailman/listinfo/tutor
Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

 "input('Something') displays the prompt 'Something' and then waits forinput up to a new line. When you enter the input it will execute thenext statement which may be another input()." It should be so,man,I believe you.But believe me when I say that THIS DAMN INTERPRETER DOES NOT ACT ACCORDINGLY!!!Sorry for the emotive caps,it's just frustration biting my ancles...Maybe it's a SPE problem?? Thank you.  2007/1/20, Kent Johnson <[hidden email]>: Karl Wittgenstein wrote:> I would also like to ask what skills you think I should develop so I can > approach programming more> ' natively', and would like to clarify the following issue:> input("Something") usually displays Something when prompting for> input;why is that the case when I run a single line of code and isn't > when I use many?When I run three lines straight in this format,only the> first message and prompt are displayed...That is surely out of the scope> of my current knowledge....Which is not very encompassing,anyway. input('Something') displays the prompt 'Something' and then waits forinput up to a new line. When you enter the input it will execute thenext statement which may be another input(). Kent _______________________________________________ Tutor maillist  -  [hidden email] http://mail.python.org/mailman/listinfo/tutor
Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

 Karl Wittgenstein wrote: > "input('Something') displays the prompt 'Something' and then waits for > input up to a new line. When you enter the input it will execute the > next statement which may be another input()." > It should be so,man,I believe you.But believe me when I say that THIS > DAMN INTERPRETER DOES NOT ACT ACCORDINGLY!!!Sorry for the emotive > caps,it's just frustration biting my ancles...Maybe it's a SPE problem?? > Thank you. Can you describe exactly what you are doing? And please stop with the swear words, they are not appropriate to this list. Kent _______________________________________________ Tutor maillist  -  [hidden email] http://mail.python.org/mailman/listinfo/tutor
Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

 Ok,got the script working almost fine now...The only problem is that the program window closes before we can get a glimpse of the answer...I use SPE under WinXP, and have seen this problem in every script i try...This is the script,as redone by a Smart Caring Dude on this list: global altura_aeronave, largura_aeronave, comprimento_aeronave, comprimento,largura, altura def compativel():   global altura, altura_aeronave, comprimento, comprimento_aeronave, \          largura, largura_aeronave   if not largura <= largura_aeronave:       print 'Volume largo demais!'    elif not altura <= altura_aeronave:       print 'Volume alto demais!'   elif not comprimento<=comprimento_aeronave:       print 'Volume comprido demais!'def define():   global largura, altura, comprimento    largura=input("Por favor informe a largura do volume em cm")   altura=input("Por favor informe a altura do volume em cm")   comprimento=input("Por favor informe o comprimento do volume em cm") def porao():   global altura_aeronave, largura_aeronave, comprimento_aeronave   porao = input("Por favor informe o porão a ser utilizado:1-4")   if porao == 1 :       altura_aeronave = 111        largura_aeronave = 112       comprimento_aeronave = 211 #You originally had comprimento here?       return 1   elif porao == 4:       altura_aeronave = 112       largura_aeronave = 113       comprimento_aeronave = 212 #Same here        return 1   else:       print "Porao inexistente!" if porao():   define()   compativel() 2007/1/20, Kent Johnson <[hidden email]>: Karl Wittgenstein wrote:> "input('Something') displays the prompt 'Something' and then waits for > input up to a new line. When you enter the input it will execute the> next statement which may be another input()."> It should be so,man,I believe you.But believe me when I say that THIS> DAMN INTERPRETER DOES NOT ACT ACCORDINGLY!!!Sorry for the emotive > caps,it's just frustration biting my ancles...Maybe it's a SPE problem??> Thank you.Can you describe exactly what you are doing? And please stop with theswear words, they are not appropriate to this list. Kent _______________________________________________ Tutor maillist  -  [hidden email] http://mail.python.org/mailman/listinfo/tutor
Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

 In reply to this post by Kent Johnson Sorry for the swear words... 2007/1/20, Kent Johnson <[hidden email]>: Karl Wittgenstein wrote:> "input('Something') displays the prompt 'Something' and then waits for > input up to a new line. When you enter the input it will execute the> next statement which may be another input()."> It should be so,man,I believe you.But believe me when I say that THIS> DAMN INTERPRETER DOES NOT ACT ACCORDINGLY!!!Sorry for the emotive > caps,it's just frustration biting my ancles...Maybe it's a SPE problem??> Thank you.Can you describe exactly what you are doing? And please stop with theswear words, they are not appropriate to this list. Kent _______________________________________________ Tutor maillist  -  [hidden email] http://mail.python.org/mailman/listinfo/tutor
Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

 In reply to this post by Karl Wittgenstein * Karl Wittgenstein <[hidden email]> [2007-01-20 13:10]: > Ok,got the script working almost fine now...The only problem is that the > program window closes before we can get a glimpse of the answer...I use SPE > under WinXP, and have seen this problem in every script i try...This is the > script,as redone by a Smart Caring Dude on this list: It sounds like you need to run it from a command window.  Running it the way you are isn't meant to leave a window up after the script is finished. Do Start->Run->cmd  on XP to get a command window.  python should already be in your path, so typing "python" at the propmt should result in it running the interpreter.  If that works, exit the interpreter and type "python scriptname" That should run your script, and you will see the results in the command window because it won't close after the script is done. -- David Rock [hidden email] _______________________________________________ Tutor maillist  -  [hidden email] http://mail.python.org/mailman/listinfo/tutor
Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

 In reply to this post by Karl Wittgenstein Karl Wittgenstein schreef: > Ok,got the script working almost fine now...The only problem is that the > program window closes before we can get a glimpse of the answer...I use > SPE under WinXP, and have seen this problem in every script i try... Any program running in a console window does that. There are two ways around: - open a console window and run your program from there, as David Rock describes - you can work around it by adding raw_input("Press enter") as the very last line of the script -- If I have been able to see further, it was only because I stood on the shoulders of giants.  -- Isaac Newton Roel Schroeven _______________________________________________ Tutor maillist  -  [hidden email] http://mail.python.org/mailman/listinfo/tutor
Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

 In reply to this post by Karl Wittgenstein Dear Karl, I use getch() when I start my script from the windows desktop and I am interested about its output. import msvcrt raw_input('Are you distressed ?\n') print ('It will be better, I am sure :)') msvcrt.getch() # append as last line > Subject: Re: [Tutor] 'elp!!!!!!!1Totally Clueless Newbie In Distress > To: [hidden email] > Message-ID: <[hidden email]> > Content-Type: text/plain; charset=us-ascii > * Karl Wittgenstein <[hidden email]> [2007-01-20 13:10]: > > Ok,got the script working almost fine now...The only problem is that the > > program window closes before we can get a glimpse of the answer...I use SPE > > under WinXP, and have seen this problem in every script i try...This is the > > script,as redone by a Smart Caring Dude on this list: Yours sincerely, ______________________________ János Juhász _______________________________________________ Tutor maillist  -  [hidden email] http://mail.python.org/mailman/listinfo/tutor
Open this post in threaded view
|

## Re: 'elp!!!!!!!1Totally Clueless Newbie In Distress

 János Juhász wrote: > Dear Karl, > > > I use getch() when I start my script from the windows desktop and > I am interested about its output. > > import msvcrt > raw_input('Are you distressed ?\n') > print ('It will be better, I am sure :)') > msvcrt.getch() # append as last line And where is the interesting output?  What were you expecting, and what did you get? _______________________________________________ Tutor maillist  -  [hidden email] http://mail.python.org/mailman/listinfo/tutor