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
For a processor to be able to process an instruction, it requires to be able to determine what the instruction is asking to be carried out. For this to take place, the CPU requires

what duality principle and huntington postulates

IP provide connectionless service to upper layer IP protocol is very simple could not guarantee the reliability of transportations IP protocol is Point to Point IP provide the unif

Question 1: (a) How would you describe human reasoning? (b) Describe the different types of human reasoning? Question 2: (a) What are the computational factors affec

The Central Processing Unit : Central Processing Unit (CPU) is the brain of the computer. The intricate electronic circuitry of the CPU performs the computer's tasks of handling d

Question 1 List and explain the ways used to close an MS Word document Question 2 What is MS-Excel? List the steps involved in starting Microsoft Excel Question 3 What i

Need of artificial intelligence: Artificial Intelligence may be seen as just the latest tool in the philosopher's toolbox for answering these all questions about the behavior o

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''''''''a''''''''-'''''''

even though most systems only distinguish among user and kernel modes, some CPUs provide multiple modes. Multiple modes could be used to provide a finer-grained security strategy.

Output Devices: Each output unit of computer system transmits information from the CPU andĀ converts the electrical pulses to an appropriate output form. A printer, for example