Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 07-19-2009, 01:22 PM   #1
In Runtime
 
TitanMATRIX's Avatar
 
Join Date: Jul 2009
Posts: 202
Send a message via MSN to TitanMATRIX
Default Python problems

Hi!,

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
__________________

__________________
***Network Warrior***
TitanMATRIX is offline   Reply With Quote
Old 07-28-2009, 03:12 AM   #2
Baseband Member
 
WhatsMyUserName's Avatar
 
Join Date: Jul 2009
Posts: 21
Default Re: Python problems

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
__________________

WhatsMyUserName is offline   Reply With Quote
Old 08-06-2009, 01:04 PM   #3
Beta Member
 
Join Date: Aug 2009
Posts: 3
Default Re: Python problems

ok here is a simple way to do that...

print 'Do not press the a button'
a = 'BOOM!!'
daveman is offline   Reply With Quote
Old 08-13-2009, 01:20 AM   #4
Daemon Poster
 
RewtGuy's Avatar
 
Join Date: Dec 2004
Posts: 595
Send a message via AIM to RewtGuy
Default Re: Python problems

Code:
a = 'do not press that button'
a
if a:
	print 'boom!'
try that... with the indent.
__________________
Windows: A thirty-two bit extension and GUI shell to a sixteen bit patch to an eight bit operating system originally coded for a four bit microprocessor and sold by a two-bit company that can't stand one bit of competition.
RewtGuy is offline   Reply With Quote
Old 08-18-2009, 01:10 AM   #5
In Runtime
 
TitanMATRIX's Avatar
 
Join Date: Jul 2009
Posts: 202
Send a message via MSN to TitanMATRIX
Default Re: Python problems

I started learning C++ instead... thought that this might be an easier one to learn.
__________________
***Network Warrior***
TitanMATRIX is offline   Reply With Quote
Old 08-18-2009, 04:36 AM   #6
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: Python problems

Quote:
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.
berry120 is offline   Reply With Quote
Old 08-19-2009, 07:51 PM   #7
In Runtime
 
TitanMATRIX's Avatar
 
Join Date: Jul 2009
Posts: 202
Send a message via MSN to TitanMATRIX
Default Re: Python problems

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
__________________
***Network Warrior***
TitanMATRIX is offline   Reply With Quote
Old 08-19-2009, 08:01 PM   #8
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: Python problems

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!
berry120 is offline   Reply With Quote
Old 08-20-2009, 11:06 PM   #9
In Runtime
 
TitanMATRIX's Avatar
 
Join Date: Jul 2009
Posts: 202
Send a message via MSN to TitanMATRIX
Default Re: Python problems

Quote:
Originally Posted by berry120 View Post
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.
__________________

__________________
***Network Warrior***
TitanMATRIX is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 04:20 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0