You are on page 1of 17

BASIC

PYTHON
PROGRAMMING

 NAME - SMRUTI RANJAN SETHY


 BRANCH - C.S.E
 SUB - EVALUATION OF INTERNSHIP - 1
 REGD NO - 2001109205
 SEMESTER - 3rd
INTRODUCTION TO COMPUTER LANGUAGE

Human languages are known as natural languages.


Unfortunately, computers can not understand natural
languages, as a result we must communicate with
computers using computer languages.
Programming languages is basically computer language
which is a set of rules and algorithm and give
information to the computer to performing operations.
It is basically, tools which execute programs written by
human readable language to machine form and create
executable models.
ORIGIN OF PYTHON PROGRAMMING
 Python was conceived in the late 1980s by Guido van Rossum at Centrum Wiskunde &
Informatica (CWI) in the Netherlands as a successor to the ABC programming language, which was
inspired by SETL, capable of exception handling and interfacing with the Amoeba operating system. 
 Its implementation began in December 1989.
 Python 2.0 was released on 16 October 2000, with many major
new features, including a cycle-detecting garbage collector 
(in addition to reference counting) for memory management 
and support for Unicode.
 Python 3.0 was released on 3 December 2008 with more
testing and includes new features.
VARIABLES IN PYTHON
 Variables are nothing but reserved memory locations to store values. This means that when we
create a variable we reserve some space in memory.
 Based on the data type of a variable, the interpreter allocates memory and decides what can be
stored in the reserved memory.
 Therefore, by assigning different data types to variables, we can store integers, decimals or
characters in these variables.
 Rules for Python variables:
a. A variable name must start with a letter or the underscore character
b. A variable name cannot start with a number
c. A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9,and _ )
d. Variable names are case-sensitive (age, Age and AGE are three different variable)
 Python variables do not need explicit declaration to reserve memory space. The declaration
happens automatically when you assign a value to a variable.
OPERATORS IN PYTHON
 Arithmetic Operator (+, -, *, /, //, %, **)
(==, >, <, <=, >=, <>,
 Comparison Operator
!=)
(=, +=, -=, *=, /=, //=,
 Assignment Operator **=, %=)

 Logical Operator (and, or, not)


(&, |, ^, ~, <<,
 Bitwise Operator >>)
 Membership Operator (in, not in)

 Identity Operator (is, is not)


DECISION MAKING STATEMENT
Decision making is required when we want to execute a code only if a certain condition is satisfied
LOOPS IN PYTHON
 Loops in Python programming language repeatedly executes a target statement as long
as a given condition is true.
 Loops has the ability to iterate over the items of any sequence, such as a list or a string.

TYPES OF LOOP

Continue…..
DATA STRUCTURE IN PYTHON
 It is the way of organizing and storing data so that operations can be performed
efficiently.
 Accessing, inserting, deleting, finding, and sorting the data are some of the basic
operations that one can perform using data structures.

TYPES OF DATA STRUCTURE:

1. String – string will be inside single ‘ ‘ or double “ “ quotations.


2. List – [ ]
3. Tuple – ( )
4. Dictionary – { }
FUNCTION IN PYTHON
 A function is a block of organized, reusable code that is used to perform a single, related
action.
 Python gives us many built-in functions like print(), etc. but we can create our own
functions.
SYNTAX

def function_name(arguments):
Statement(s)

TYPES OF FUNCTION
• Built-in Functions
• User-defined Functions
• Anonymous Functions

TYPES OF ARGUMENTS
• Required Arguments
• Keyword Arguments
• Default Arguments
• Variable-Length Arguments
MODULE IN PYTHON
 Python module can be defined as a python program file which contains a python code
including python functions, class, or variables.
 In other words, we can say that our python code file saved with the extension (.py) is
treated as the module.
 We may have a runnable code inside the python module.
 A module in Python provides us the flexibility to organize the code in a logical way.
 To use the functionality of one module into another, we must have to import the specific
module.

from modname import


import module1[,
name1[, name2[, ...
module2[,... moduleN]
nameN]]

 Every module has its own functions, those can be accessed with . (dot)
FILE HANDLING IN PYTHON
 A file is some information or data which stays in the computer storage devices like music files, video files,
text files.
 Python gives us easy ways to manipulate these files.
 Python has a built-in function open() to open a file.
Open (‘Path/to/file’, mode)

 MODES IN FILE:
There are three modes in which file can be access.
 Read or ‘r’
 Write or ‘w’
 Append or ‘a’
'x’ - Creates a new file. If file already exists, the operation fails.
'a’ - Open file in append mode. If file does not exist, it creates a new file.
't’ - This is the default mode. It opens in text mode.
'b’ - This opens in binary mode.
'+’ - This will open a file for reading and writing (updating)
APPLICATION OF PYTHON LANGUAGE
 Python can serve as a scripting language for web applications, e.g., via mod_wsgi for
the Apache web server.
 Libraries such as NumPy, SciPy and Matplotlib allow the effective use of Python in
scientific computing, with specialized libraries such as Biopython and Astropy providing
domain-specific functionality.
 Python is commonly used in artificial intelligence projects and machine learning projects
with the help of libraries like TensorFlow, Keras, Pytorch and Scikit-learn. As a scripting
language with modular architecture, simple syntax and rich text processing tools, Python
is often used for natural language processing.
 Python can also be used to create games, with libraries such as Pygame, which can make
2D games.
 Many operating systems include Python as a standard component.
 Python is used extensively in the information security industry, including in exploit
development.

You might also like