Python Introduction
***FOR BETTER VIEWING EXPERIENCE USE DESKTOP VIEW MODE***
##############################################################################
# Python Programming language was developed by Guido Van Rossum in February 1991.
# It is an interpreted, high-level, general-purpose programming language.
# Programming helps human to reduce manual efforts and
# work which take hours to complete can be accomplished by computer in Seconds.
# To write any language’s code we need a platform where
# we can write the code and can execute it.
# For this we use IDE’s.
# IDE – IDE (Integrated Development Environment)
# is a software application which provides many comprehensive facilities
# to programmers for software or application development.
# You can use Pycharm and Visual Studio Code as IDE
#############################################################################
####### Installation ######
###### First of all download Python :
# Go to this link - https://www.python.org/downloads/
# From the above link download latest version of Python
# After visiting this link simply click on download python button
# Your download will start...
###### Now, Let’s download Pycharm :
# Pycharm – It’s one of the best Integrated Development Environment for Python Language.
# It is developed by the Czech company JetBrains.
# Go to this link - https://www.jetbrains.com/pycharm/download/#section=windows
# After visiting the above link download community version of Pycharm.
# Simply click on community button to download it.
# Your download will start...
###########################################################################
#### After that simply install them like any other normal software.
## After Installing both Python & Pycharm:
# Open terminal (Powershell in case of windows) and then type ‘Python’ and press Enter.
# You should see the output like this ...
# Windows PowerShell
# Copyright (C) Microsoft Corporation. All rights reserved.
# Try the new cross-platform PowerShell https://aka.ms/pscore6
# PS C:\Users\SASWATA KAYAL> python
# Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32
# Type "help", "copyright", "credits" or "license" for more information.
# >>>
# You can exit the interpreter by typing the following command: quit().
############################################################################
########################## Application of Python ###########################
# You can do almost every thing using Python like
# Web Development
# Game Development
# Data Science
# Machine Learning
# and Many more things
Modules & Pip
***FOR BETTER VIEWING EXPERIENCE USE DESKTOP VIEW MODE***
########################################################################################
# Sometimes we have to use someone else’s code(Module) in
our program
# because it saves our lot of time and off-course it is
legal and free.
#### Modules ####
# Module – Module or library is the file which contain
definitions of several functions,
# classes, variables, etc. which are written by someone
else for free use.
#### Pip ####
# Pip – Pip is a package manager in python
# i.e. pip command is used to download any external
module in python.
# It is something like which helps us to get something
from somewhere
# and automatically save packages at suitable location for
futher use.
### We can install any module in our system by pip
command :
# Simply open cmd or Powershell in your system.
# And then type pip install module_name and press enter.
### Example :
# >pip install numpy
# After that the module will start downloading
# and will install automatically in your computer.
# After installing any module in python
# you can import it in your program or in your project of
Python.
### Example :
## In file xyz.py write: ##
import numpy
########## There are 2 types of modules in Python :
# Built-in Modules -
# Built-in modules are those modules which are
pre-installed in python
# i.e. there is no need to download them before using.
# These modules come with python interpreter itself.
# Example – random module, winreg, etc.
# To get complete list of built-in modules of python -
link =
"https://docs.python.org/3/py-modindex.html"
# External Modules –
# These are those modules which are not pre-installed in
python
# i.e. we need to download them before using in our
program.
# Example – Flask, Pandas, etc.
##################### That's all about modules in Python.
#########################
################################ Extra Content ###################################
## The following command will install the latest version
of a module
# and its
dependencies from the Python Packaging Index:
#=>$ pip install SomePackage
## It’s also possible to specify an exact or minimum
version directly on the command line.
# When using
comparator operators such as >, < or some other special character which
get
# interpreted by shell, the package name and the version
should be enclosed within double quotes:
#=>$ pip install SomePackage==1.0.4 # specific version
#=>$ pip install
"SomePackage>=1.0.4" #
minimum version
## Normally, if a suitable module is already installed,
# attempting to install it again will have no effect.
# Upgrading existing modules must be requested
explicitly:
#=>$ pip install --upgrade SomePackage
Python Tutorial 1---
This is the First or a Basic program of Python
DOC
Let's get to business and start writing our first python program. Follow the below steps:
- Open Pycharm and create a new file in it.
- Keep in mind the file name should not match any module name.
- After creating a new file, type print("Hello World")
- And then run your program.
- You will get the output as "Hello World."
So, this is our first python program, and in this program, we just used a print function. In this function, whatever we pass in parenthesis () in a double quote or single quote gets printed (as it is) on the screen.
CODE
print("Hello World")
OUTPUT
C:\Python38\python.exe C:/Users/Saswata/PycharmProjects/pythontuts/Tut1.py
Hello World
Process finished with exit code 0
Comments
Post a Comment