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
Selects among the processes in memory which are ready to execute & allocates the CPU to one of them CPU scheduling decisions can be taken place when a process: A. Terminates B. Swi

Computers can be used for better and more efficient management and organisation of laboratories. A computer like the human brain receives information, stores and processes it and t




Systems Software: Systems software is generally supplied by the hardware manufacturers. It includes operating systems, assemblers, compilers, and interpreters (to convert prog

THE SECOND GENERATION (1956-1965) This generation of computers were characterized by:     Considerable reduction in physical size     Increased reliability

Question 1 List down any six features of a Smartphone Question 2 Give a brief note on a) Internal Flash Disk. b) Use of C++ in Symbian OS Question 3 What are the naming

Number data types store numeric values. They are an immutable data type, which means that changing the value of a number data type results in a newly allocated object. Number objec

Magnetic Memory:  In the above section we have seen various types of semiconductor RAMs. These high speed semiconductor storage devices (i.e. RAMs) are expensive. So we need s