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
The Scheduling algorithms can be divided into two parts with respect to how they deal with clock interrupts. 1) Nonpreemptive Scheduling: A scheduling


what are the chrateristics of vector processing

File Organization There are three types of file organization used in practice. Let us consider the example of a dictionary. The dictionary contains listing of English wo

Question 1 What is NANP? Explain Question 2 What is E&M signaling? Discuss in brief Question 3 What are the common custom calling features? Question 4 Expl


They are particular register instructions. They are used to load bytes or sequences of bytes onto a register. LODS (LODSB) (LODSW) LAHF LDS LEA LES LODS (LODSB) (LODSW) INSTRUCTION

different types of software interfaces which falls in different categories


Simple Batch Systems: Early machines were very expensive, and therefore it was important to maximize machine utilization. To improve utilization, the concept of batch operat