subjects

Dropdown Menu

Monday 15 February 2021

Structure of Python

 

Structure of Python: unlike other languages python allow us to write code in a simplified manner.

As all mentioned sections are optional the developers are free to choose their own style of writing code





Documentation section: This section consists of basic information related to the program.

We use comments to provide readability and understand ability to user

Single line comments: they start with #   Ex:  # this is a single line comment

Multi line comments: these are doc strings used with triple quoted text

Ex:   “ “ “ This is

                An example of doc strings” ” ”

Import statements:  In python library is organized as modules. When we want to make use of library functions we have to import modules.

Ex: import math

Statements: can be expressions, conditional statements, looping statements etc.

Functions: functions are used to write a group of statements to do a task. We can write any number of functions in our program.

 

Classes:  A class is model for creating objects. We can write classes in python program.



No comments:

Post a Comment