Posts

PYTHON COMMENTS!!!

  Python Comments A comment is a part of the coding file that the programmer does not want to execute, rather the programmer uses it to either explain a block of code or to avoid the execution of a specific part of code while testing.   Single-Line Comments: To write a comment just add a ‘#’ at the start of the line. Example 1: #This is a 'Single-Line Comment' print ( "This is a print statement." ) Copy Output: This is a print statement. Copy   Example 2: print ( "Hello World !!!" ) #Printing Hello World Copy Output: Hello World !!! Copy   Example 3: print ( "Python Program" ) #print("Python Program") Copy Output: Python Program Copy     Multi-Line Comments: To write multi-line comments you can use ‘#’ at each line or you can use the multiline string. Example 1:  The use of ‘#’. #It will execute a block of code if a specified condition is true. #If the codition is false than it will execute another block of code. p = 7 if ( p >...

PYTHON SYNTAX

  What is Syntax? In simplest words,  Syntax is the arrangement of words and phrases to create well-formed sentences in a language . In the case of a computer language, syntax is the structural arrangement of comments, variables, numbers, operators, statements, loops, functions, classes, objects, etc. which helps us understand the meaning or semantics of a computer language.   E.g. a ‘comment’ is used to explain the functioning of a block of code. It starts with a ‘#’. More on comments in the comments chapter.   E.g. a block of code is identified by an ‘indentation’. for i in range ( 5 ) : print ( i )