#PythonProgramming #RemoteLearning #CodinginPython
Basic Structure of a Python Program!
-expressions
-statements
-comments
-function
-Blocks & indentation
An expression is any legal combination of symbols that represents a value.
An expression represents something which python evaluates and which produces a value.
E.g. 10, x + 5
A statement is a programming instruction that does something i.e. some action takes place.
A statement executes and may or may not results in a value.
E.g. print(x + 2), y = x + 5, x = 10
Comments are the additional readable information to clarify the source code.
Comments in Python are the non-executable statements which begin with a hash symbol (#) and generally ends with end of the line.
E.g. #This is a sample python program
A function is a code that has a name and it can be reused (executed again) by specifying its name in the program, where needed.
A function begin with ‘def’ statement
E.g. goinggood( )
A group of statements which are part of another statement or a function are called block or code-block or suite in python.
Indentation is used to show blocks in python. Four spaces together mark the next indent-level.
Ref:
Preeti Arora, “Computer Science with Python (Textbook of CBSE Class XII)”, Sultan Chand & Sons, 2020
Sumita Arora, “Computer Science with Python (Textbook of CBSE Class XII)”, Dhanpat Rai & Co., 2020