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
Where can I get free software for drawing K maps

What is CAI? Explain its pitfalls.


RANDOM ACCESS MEMORY (RAM): The RAM-type memory will allow data to be written into it, as well as read from it. With very few exceptions, RAMS lose their contents when the powe

Question 1 Explain the TCP/IP protocol layers Question 2 Write a note Fiber Distributed Data Interface (FDDI) Question 3 Discuss on File Transfer Protocol (FTP)

Chat: The word chat in English language means - casual conversation. On Internet it means the same, except that you need to use text and your keyboard skills are tested. Earli

A Patient Registry Name, Surname and Address  Sex  Caste  Contact Numbers  Area (Rural/Urban/Suburban)  City/District  State  General Examination deta

ASCII code:  An alphanumeric code has to represent 10 decimal digits, 26 alphabets and certain other symbols such as punctuation marks and special characters. Therefore, a min

Classify computer systems according to capacity. How they are different from computers according to the classification of technology. Provide comparative study also.

The unconditional jumps in a written program in assembler language are specified by the jmp instruction; a jump is to moves the flow of the execution of a program by sending the co