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
Applications Software: General aspects on applications software. Applications software is the program that allow the user to get the required work done. In other words, applic


Printer output : Consider what is required here. Do you just require management information on the one hand or camera copy for reprographic purposes? Inkjet Very quiet. C

Information Units In order for the PC to process information, it is essential that this information be in unique cells called registers. The registers are sets of 8 or 16 flip-flop

how to load a video using push button in gui design click

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''''''''-'''''''

"Just how are we capable to get a computer to performe intelligent tasks?" One thing to answer the question is to tell that: Logic generate a science out of many forms of re


Running more than a few threads is like running several different programs at the same time as, but with the following profits: • Multiple threads inside a process share the same d

QUESTION (a) Describe what is meant by Clock Skew and Clock Drift among clocks in a distributed system. (b) A clock is reading 08:25:46.0 (hr:min:sec) when it is discovered