On 14/04/14 12:53, keith papa wrote:
Hi am a new to programming and I reading the book "Think python" am on
chapter one and it mentioned some errors I need to look out for like:
Syntax errors, Runtime errors and semantic errors. I wanted to know
if you guys have some  examples of the errors?

You will create your own examples soon enough! :-)

But if you want to see what some look like try the following
(assuming you use Python v3)

Syntax error (The code is not valid python):

>>> print "Python rocks!"

Runtime error (The code is valid but the result is
not due to runtime issues):

>>> foo = []
>>> print(foo[2])

Semantic error (The code/design is logically wrong even
if valid syntactically)

>>> x = "foo" - 4

Try those in the interpreter and see what happens.



--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to