Lines and Indentation in python , Basic Computer Science

Assignment Help:
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.


Related Discussions:- Lines and Indentation in python

Software, Software Computer cannot be used without a software in...

Software Computer cannot be used without a software in it. It is the software which gives instructions to the hardware of the computer so as to work all devices in tande

Open source software, Open Source Software: Open Source Software (OSS)...

Open Source Software: Open Source Software (OSS) is software that comes with source code, and importantly also provides rights (typically reserved for copyright holders) to st

Flowchart, i need help with flowcharting a procedure

i need help with flowcharting a procedure

How to Open a FCB files?, Opening files 0FH function is used to open an F...

Opening files 0FH function is used to open an FCB file the 21H interruption. The element, the name and extension of the file must be initialized previous to opening it. The DX regi

Calculate simple interest -algorithm, Algorithm : 1. Read the values of pri...

Algorithm : 1. Read the values of principal amount, time and rate of simple interest into the locations labelled as P, T, R. 2. Set the count T to 1 implying the end of a year. 3.

Explanation of different graphics applications, Problem 1 What are grap...

Problem 1 What are graphic applications? Explanation of different graphics applications Problem 2 Open the case cover of your CPU of your computer system and l

Magnetic media, what are the five precautions to be observed when handling ...

what are the five precautions to be observed when handling magnetic media?

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd