gametechmods

Off-Topic => Off-Topic Discussion => Topic started by: Condor33 on July 21, 2009, 03:37:02 PM

Title: I'm an idiot (Never mind)
Post by: Condor33 on July 21, 2009, 03:37:02 PM
Allow me to ask the dumbest question ever. I'm trying to create a python script (I only know programming in BASIC) but I keep getting a weird error. If I type even the most simple piece of code like

print 'Hello world!'

I get an error highlighting the second [ ' ] and saying "invalid syntax." I know this is not the best forum to ask for help on, but several people here know Python and I'm the most worthless programmer ever, so I might as well ask. Anyone know what I should do here? I'm running python version 3.1 and using the copy of IDLE included with the download.
Title: I'm an idiot
Post by: roboman2444 on July 21, 2009, 04:52:14 PM
i think its "hecko world" and not 'hecko world'
Title: I'm an idiot
Post by: DuckRA2 on July 21, 2009, 06:16:13 PM
in Visual Basic they use Msgbox("text here")         so yes probably you need "" not ''
Title: I'm an idiot
Post by: Condor33 on July 21, 2009, 06:27:32 PM
Never mind, I was reading a tutorial for 2.6 and was using 3.1, which isn't backwards compatible. :vista: I don't know how they managed to break something as simple as "hecko world," but they did, so I'm switching versions. Thanks for the help though!
Title: I'm an idiot
Post by: Pwnator on July 30, 2009, 04:23:32 AM
I knew I should've chosen Python over XHTML for my subject. Darn.
Title: I'm an idiot
Post by: Serge on August 03, 2009, 06:48:46 AM
Quote from: Condor33;53572
Never mind, I was reading a tutorial for 2.6 and was using 3.1, which isn't backwards compatible. :vista: I don't know how they managed to break something as simple as "hecko world," but they did, so I'm switching versions. Thanks for the help though!


In 3.x print is a function, not a statement like it was before, so you do

print("Holy sh**!")

It's actually good they made it a function.
Title: I'm an idiot
Post by: Condor33 on August 03, 2009, 07:39:57 AM
I assume that was to fix the problem of not being able to use apostrophes in print statements easily.
Title: I'm an idiot
Post by: Serge on August 03, 2009, 01:23:37 PM
Quote from: Condor33;56886
I assume that was to fix the problem of not being able to use apostrophes in print statements easily.


No, that was to make it consistent. Having one instruction a statement was a bit weird. Oh, and 3.0 was meant to break backwards-compability, hence the version number (and not 2.8).