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 development, requirement analysis and specification for online vot...

requirement analysis and specification for online voting

Memory hierarchy, Memory hierarchy: There is another type of high spee...

Memory hierarchy: There is another type of high speed memory, known as Cache memory, which is used to increase the speed of processing by making current programs and data avai

Differentiate the client–server and peer-to-peer models of d, The client-se...

The client-server model firmly differentiates the roles of the client and server. According to this model, the client requests services that are provided by the server. The peer-to

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.

Excel, Your next step is to analyze "proposed" technical requirements/specs...

Your next step is to analyze "proposed" technical requirements/specs based on the business requirements (new performance needs) for Big Bucks. 1.Create a "CRUD" Matrix in an Exce

Short program to practice assembly language loops, Purpose of Code This...

Purpose of Code This is a short program to practice assembly language loops and if/else statements. You will use various jump commands and the cmp instruction.  The progra

Function, write a function named "location_of_largest"that takes as its arg...

write a function named "location_of_largest"that takes as its arguments the following:(1) an array of integer values

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