newbie questions
have a few questions...i'm a newbieso i'd appreciate any help 1- what is the difference between Python GUI and Python command line? 2-in Python command line when I hit enter after typing a command I cannot go back and "delete" "backspace" or otherwise edit a previous command...why? 3-I have tried the following example from "how to think like a computer scientist" def makeline(): print print "firstline" makeline() print "secondline" problem iswhenever I type -print "firstline"- and then hit enter...well it follows the command and gives "firstline" EX. print "firstline" firstline instead of giving me a chance to type in -makeline()- and thus completing the example Anybody help here?? thanks -xray- __Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
"how to think like a computer scientist"
Ok...I'm new to Python..and of course am already having troubles. I have tried the following example from "how to think like a computer> scientist">> def newline():> print>> print "firstline"> newline()> print "secondline">> problem iswhenever I type -print "firstline"- and then hit enter...well> it follows the command and gives "firstline" EX.> print "firstline"> firstline>> instead of giving me a chance to type in -newline()-> and thus completing the example which when finished should look like this: firstline secondline Can anybody tell me what is going on here?__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
"how to think like a computer scientist"
I am using the book "how to think like a computer scientist" and am finding the examples are not working with Python 2.4.2...I have typed them exactly as they appear in the textcan someone relate to this?...is this typical b/c 2.4.2 is a newer version? -xray- Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
RAW_INPUT
I am having trouble with the following example used in a tutorial: print "Halt !" s = raw_input ("Who Goes there? ") print "You may pass,", s I run this and get the following: Halt! Who Goes there? --thats itif I hit enter again "You may pass," appears... In the example after running you should get: Halt! Who Goes there? Josh You may pass, Josh I'm assuming s=Josh...but that is not included in the statement at all I don't know how you put "Josh" in or how you got it to finish running w/o hitting enter after "Who goes there?" What am I doing wrong? thanks, -xray- Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
what the %?....
Hey can somebody tell me what the "%" function does...I am not math illiterate...its just a new symbol for meis it a divisor? remainder something another?? thanks -xray- Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
RAW_INPUT-----NEVERMIND I FIGURED IT OUT
i had posted a previous question but I figured it out...thanks Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
Python Countdown
I am running the following program from the example in "how to think like a computer scientist" def countdown(n): if n ==0: print "Blastoff!" else: print n countdown (n-1) countdown (1000) When I set "n"= 1000 the program runs in interpreter and stops counting down at 14 instead of running all the way to "Blastoff". If I set n = 985 it completes the program. If I set n=1200 it runs to 214 and stops. Why is this program only counting to 986Anybody have an answer?? I am using Python 2.4.2 Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
tutorial example
Can somebody tell me why you have to have "return result" in the below program as suggested in a beginner tutorial. I ran the second listed program below without "return result" and they both give the same value in Python interpreter. What does "return result" do? def distance(x1, y1, x2, y2): dx = x2 - x1 dy = y2 - y1 dsquared = dx**2 + dy**2 result = math.sqrt(dsquared) print result return result def distance(x1, y1, x2, y2): dx = x2 - x1 dy = y2 - y1 dsquared = dx**2 + dy**2 result = math.sqrt(dsquared) print result Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
how to think like a computer scientist
Question for the following program: sec 5.5 def factorial (n): if n == 0: return 1 else: recurse = factorial (n-1) result = n * recurse return result How come whenever I state the function with "n" given a value it prints no results in the interpreter for EX: def factorial (n): if n == 0: return 1 else: recurse = factorial (n-1) result = n * recurse return result factorial (3) So instead I have to give a "print" command to make the result appear in the interpreter for EX: def factorial (n): if n == 0: return 1 else: recurse = factorial (n-1) result = n * recurse return result print factorial(3) Is this correctshould I have to give a print command?? Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
tutorial example?????
OK...I have the following program i = 1 while i <= 6: print 2 * i,' ', i = i + 1 print this is supposed to give you a "new" blank line after the program runs instead it just gives: 2 4 6 8 10 12 >>> instead of: 2 4 6 8 10 12 >>> to get the above return I have to type in "print" twice,this can't be right?..ANY SUGGESTIONS? i = 1 while i <= 6: print 2 * i,' ', i = i + 1 print print Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
HOW do you stop a print???
ok...I am running the following program: def printMultiples (n): i = 1 while i <= 6: print n*i, ' \t ', i = i + 1 i = 1 while i <= 6: printMultiples(i) i = i + 1 this is supposed to return a simple multiplication table, but for some reason it does not want to stop printing after 6 columns...instead it prints from left to right for a total of 10 columns...I need some sort of a "stop print" after the first 6 columns and then continue to fill in those columns...Can anybody solve this problem?... -thanks- Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
newbie help needed
I am running the following program: def print Multiples (n, high): i = 1 while i <= high: print n*i, ' \t' , i = i + 1 print def printMultTable (high): i = 1 while i <= high: print Multiples (i, high) i = i + 1 printMultiples(8,8) printMultTable(8) Basically this program prints the correct multiplication table but instead of having just 8 rows it has 9 with the top row consisting of multiples of 8 then below the top row is a normal multiplication table...How can I get rid of the top row? Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
more newbie help needed
using the following program: fruit = "banana" index = 0 while index < len (fruit): letter = fruit[index-1] print letter index= index -1 this program is supposed to spell "banana" backwards and in a vertical patern...it does thisbut after spelling "banana" it gives an error message: refering to line 4: letter = fruit[index-1] states that it is an IndexError and the string index is out of range Anybody know how to fix this? Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
string help
using the following program: prefixes = "JKLMNOPQ" suffix = "ack" for letter in prefixes: print letter + suffix if prefixes == "O" or "Q" print letter + "u" + suffix For this program I am trying to combine the individual letters with the suffix to form names...but for O and Q I need to add in a "u" so the spelling is correct...I am having a hard time pulling just the O and Q out of the list of letters for manipulation...instead it is adding "u" to all the letters when combining with the suffix...apparently its due the fact that O and Q are present in the entire "string"..anybody have some suggestions for this??... Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
Is Python worth it??
I have started out trying to learn Python for my first programming language. I am starting off with the book "how to think like a computer scientist." I spend about 4-5 hrs a day trying to learn this stuff. It is certainly no easy task. I've been at it for about 1-2 weeks now and have a very elementary picture of how Python works. I am teaching myself from home and only recieve help from this forum. Can anybody give me a timeframe as to how long it usually takes to pick something like this up, so I can maybe figure out a way to pace myself? I can dedicate a good amount of time to it everyday. Any advice on what is the best way to learn Python? I am a fairly educated individual with a natural sciences degree (forestry), so I also have a decent math background. Are there any constraints mathematically or logic "wise" that would prevent me from building a firm grasp of this language? Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
how to think like a computer scientist
Does anyone know if there is an "answer key" to all of the exercises in "how to think like a computer scientist"sure would be a lot easier to refer to that instead of tying up this forum with questions about exercises I'm sure that have been asked before Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
email separation
HeyI have signed up to receive emails from the python forum and the amount of emails I receive on any day is fairly numerous...Does anyone know if I can somehow separate all mails coming from the python forum from all of my other mail, so I can open it from another folder or something like that under the same address...I have a yahoo account... Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
yahoo sender name
hey...I know this is off the "python" topicbut I have yahoo mail and would like to change my "sender name" I have gone to the "edit account" area and have changed all names that can be edited to a consistent name other than the current sender name...but for some reason it will not change the sender name...is anybody familiar with yahoo mail and changing names? -thanks in advance- Yahoo! Music Unlimited - Access over 1 million songs. Try it free.-- http://mail.python.org/mailman/listinfo/python-list
Import - interpreter works but .py import does not
First post and very much a newbie to Python. Have 2.5 on Linux (GG). I think I have set up PYTHONPATH correctly in that I can import a module apply_bp and it complains about line 20 in apply_bp which is: import sys, aipy, numpy, os At the interpreter prompt, however, I can import sys, numpy etc. and can do dir() and see the entry points so I think my overall installation is OK. Why does line not work ? Also I would have thought that when I pre- imported sys et al that they would be in the symbol table so that the import line would be a noop. Thanks, Slainte, John -- http://mail.python.org/mailman/listinfo/python-list