Lines and Indentation in python , Basic Computer Science

One of the first caveats programmers come across when learning Python is the reality that there are no braces to point to blocks of code for class and function definitions or flow control. Blocks of code are indicated by line indentation, which is strictly enforced.
A number of spaces in the indentation is variable, but all statements in the block must be concave the same amount. Both blocks in this illustration are fine:
if True:
print "True"
else:
print "False"
On the other hand, the second block in this instance will generate an error:
if True:
print "response"
print "True"
else:
print "response"
print "False"
Thus, in Python all the continuous lines indented with same number of spaces would form a block.

Posted Date: 5/5/2012 3:12:30 AM | Location : United States







Related Discussions:- Lines and Indentation in python , Assignment Help, Ask Question on Lines and Indentation in python , Get Answer, Expert's Help, Lines and Indentation in python Discussions

Write discussion on Lines and Indentation in python
Your posts are moderated
Related Questions
Flowcharting: Flowcharting: A Flowchart is a graphical representation of an algorithm. It can be compared to the blueprint of a building. Just as a building contractor refers

#after writing the script of rebuilting indexed on db server it gave output command executed succesfully does this mean i m done

100 animals and their respiratory organs

1. (40 points) Add a course drop method to the system that you implemented in Problem Set 1. Modularize your new implementation properly. For any new methods that you introduce: 1.

Question 1 Write a long note on setting up a typical on-location News Interview Question  2 Write a long note on how to work with presenters Question 3 Write long notes

Our instructor gave us a project in making a mechanical game or simple device using assembly language, can anyone give me a an example of a project description for our proposal?

Question 1 What are the various skills needed for broadcasting and film? Question 2 What is a 2 dimensional animations and 3 dimensional animations? Question 3 Different

E-MAIL: Internet has changed the art of writing letters to email.  Email is one of the ways on Internet to send messages to another person across the network. E-mail and posta

Question 1 Write short note on                             1) NFS 2) CIFS Question 2 What is Virtual Application? Write down the benefits and drawbacks of it Questi

find the regular expression of(a/?)(a/b)?