> ---------- Forwarded message ---------- > From: "Pallab Amway" <pallabam...@gmail.com> >> Respected sir,lots of thanks for your advice,but while i am compiling >> those programe with python 2.7 no output is coming only showing the >> masage "expected indented block"
The first thing is to point out that you are getting an output - an error message. Error messages are output. The error tells you that it expects an indented block. Do you understand what that means? Indentation refers to the amount of spacing before the text. specifically there must be more space before the lines after a control statement (like your 'if') than there is on the control line. In most programming languages this is a matter of good style to make the code easier for humans to read. But it is a fundamental principle in python because the compiler uses the spacing to figure out how much code is influenced by the control statement. So an if statement should look like: if <some condition>: an indented line another indented line end of if block elif <another condition: # option elif line Yet another indented line only executed if the elif test is true else: # optional else More indented lines only executed when the if and elif parts are false. The same applied to other control statements in Python such as 'for', 'while', 'def', 'try' etc, etc. The amount of extra space you apply is up to you but the recommended size is 4 spaces (as above). > can you sugest any ebook?and please I am biased but you can try my tutorial (see .sig below) or there is a full page for beginners on the python.org web site https://www.python.org/about/gettingstarted/ -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor