Python problems

TitanMATRIX

In Runtime
Messages
202
Hi!, :confused: :confused: :confused:

I've been teaching myself python but I've ran into problems. As I'm reading tutorials online I find that my interperator isn't doing what it SHOULD be doing as I'm typing in EXACTLY how it is in the tutorials. Is this a problem with any libraries? Everytime I try to something it comes up with a "syntax error" so I'm breaking the rules somewhere (I'm just thinking that the stuff I'm trying to do isn't defined in the libraries so thats how I get the syntax). The stuff I was trying to do was simple like so:

>>> a = 'do not press that button'
>>> a
>>> 'do not press that button' #ok so it works when I enter a.
>>> if a:
... print 'BOOM!'

(now I get the syntax error)

what am I doing wrong here? I can do simple stuff like mathematics equations and defining variables in a mathematical equation or make a list or make a sentence... however this stuff doesn't want to work.

Thanks,

Nick
 
hmm... i done that command exactly and it worked out for me, with the exception that it doesn't print BOOM! when supposed to... i will look into it further then post what i find out
 
Code:
a = 'do not press that button'
a
if a:
	print 'boom!'

try that... with the indent.
 
I started learning C++ instead... thought that this might be an easier one to learn.
If anything I'd say C++ was actually harder - but on the flip side I much prefer it as a language and it's far more used :) I'd personally still suggest starting off with Java - but as long as you're ready and willing to work around some difficulties, C++ shouldn't be an impossible task to learn straight off.
 
yeah. Idk, I like Python for the most part. But I like C++ more :) I heard about Java but wasn't sure about it. That might be my next one, that or HTML
 
HTML isn't a programming language at all - by all means learn it (you can pick most of it up in a day) but don't assume it's a replacement for anything like C++ / C / Java / python / anything else along those lines! :)
 
HTML isn't a programming language at all - by all means learn it (you can pick most of it up in a day) but don't assume it's a replacement for anything like C++ / C / Java / python / anything else along those lines! :)

no no I know. I was wanting to learn website stuff along with programming languages so I just threw it in there. But I'm still sticking to C++, then Java, then finishing Python... at least thats the plan in my head.
 
Back
Top Bottom