Modules, Comments and PIP

 Modules, Comments and PIP :

    Lets write a first python program. Create a file name called "hello.py" and paste below code in it.

                                                print("hello world")

               Execute this .py file either using a python IDLE or using other softwares like PyCharm or VsCode etc. Print is a function, like printf statement in C, which prints the statements.


Modules : 

A module is a file containing code writter by somebody which can be imported and used in our program.

Like we are having Libraries in C, Packages in Java, in python we are having modules, which are pre written code.


Types of Modules :

1. Built in Modules : Which are pre installed in system. OS is a module which is Built in Module.


2. External Modules : The Modules which are need to install from external sources are called as External Modules. Pygame, flask, tkinter, etc are the examples.


Comments : Comments are non executable statements. These oftenly used to mark author name, date etc.


Types of Comments :

1. single line comment : # is used to make a statement as a comment. 


# this is a program


2. Multi Line Comment : ''' used to make multiple statement as comment.


''' hello 

this is a

multi line comment '''


PIP:

PIP is the package manager for python. we use PIP to install a External module in our system which can be used in a program.

pip install pygame      [ which installs pygame module into our system.]


****using python as a calculator : 

    Type python + on the terminal or IDLE, it opens REPL i.e Read Evaluate Print Loop



Programs:

1.  #print hello world

import os # importing the os module 
print("Hello world")


2. #Write twinkle twinkle little star poem

print('''Twinkle, twinkle, little star,
How I wonder what you are!
Up above the world so high,
Like a diamond in the sky.''')

3. #Directory List

import os
print(os.listdir())