ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662
Rep:
Print
I am trying to learn Python. I have never ever studied Python. I am running Mandriva Linux 2006 version. It is a 64 bit program.
[nissanka@c83-250-110-112 ~]$ python
Python 2.4.1 (#2, Aug 29 2005, 20:13:14)
[GCC 4.0.1 (4.0.1-4mdk for Mandriva Linux release 2006.0)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> the_world_is_flat = 1
>>> if the_world_is_flat:
... print "Be careful not to fall off!"
File "<stdin>", line 2
print "Be careful not to fall off!"
^
IndentationError: expected an indented block
>>> print "Be careful not to fall off!"
[ What is the problem with print? It says about an indentation error. What is it? How do I rectify it?]
The problem is that your print line is not indented properly, hence you get that error. If you press your tab key and then write "print "Be careful...", it'll be OK. See this for info about how Python uses whitespace and indentation. Edit: if you use the Python IDE called IDLE, the indentation is done automatically.
You may want to subscribe to the python-tutor mailing list. There are many teachers, authors, developers etc who subscribe to that list and can help you with any newbie type problems.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.