The document provides an overview of basic Python programming concepts including the structure of a Python program, data types, variables, operators, expressions, statements, functions, modules, and libraries. It discusses Python syntax elements like indentation, keywords, identifiers, literals, and escape sequences. It also covers basic Python programming concepts like input/output, operators, variables, and data types. The document is intended as an introductory guide to the basics of Python programming.
The document provides an overview of the Python programming language. It discusses why Python is useful for students and professionals, its major features like being object-oriented and having a large standard library. The document also covers Python's history, how to install it and set the environment variables, basic syntax like variables and data types, operators, and common programming constructs like conditionals and loops.
This document provides an introduction to the Python programming language. It discusses Python's design philosophy emphasizing readability. It also covers printing messages, reading input, variables and data types, operators, and basic syntax like comments and identifiers. Arithmetic, relational, logical and bitwise operators are explained along with examples.
This document provides an introduction to the Python programming language. It discusses Python's design philosophy emphasizing readability. It also covers printing messages, reading input, variables and data types, operators, and basic syntax like comments and identifiers. Arithmetic, relational, logical and bitwise operators are explained along with examples.
This presentation provides the information on python including the topics Python features, applications, variables and operators in python, control statements, numbers, strings, print formatting, list and list comprehension, dictionaries, tuples, files, sets, boolean, mehtods and functions, lambda expressions and a sample project using Python.
Functions allow programmers to organize and structure their code by splitting it into reusable blocks. There are two types of functions: built-in functions that are predefined in Python, and user-defined functions that programmers create. Functions make code easier to debug, test and maintain by dividing programs into separate, reusable parts. Functions can take arguments as input and return values. Function definitions do not alter the normal flow of a program's execution, but calling a function causes the program flow to jump to the function code and then return to pick up where it left off.
Chapter 1 Class 12 Computer Science Unit 1ssusera7a08a
The document discusses the basics of Python programming language. It provides an introduction to Python, describing how it is an interpreted, high-level and general-purpose programming language. It then covers Python features, data types, operators, and how to work in both interactive and script modes in Python. The document also discusses topics like variables, data handling, arithmetic operators, comparison operators, and more with examples.
This document provides an agenda and overview for a Python training course. The agenda covers key Python topics like dictionaries, conditional statements, loops, functions, modules, input/output, error handling, object-oriented programming and more. The introduction section explains that Python is an interpreted, interactive and object-oriented language well-suited for beginners. It also outlines features like rapid development, automatic memory management and support for procedural and object-oriented programming. The document concludes by explaining Python's core data types including numbers, strings, lists, tuples and dictionaries.
The document provides an overview of the Python programming language. It discusses why Python is useful for students and professionals, its major features like being object-oriented and having a large standard library. The document also covers Python's history, how to install it and set the environment variables, basic syntax like variables and data types, operators, and common programming constructs like conditionals and loops.
This document provides an introduction to the Python programming language. It discusses Python's design philosophy emphasizing readability. It also covers printing messages, reading input, variables and data types, operators, and basic syntax like comments and identifiers. Arithmetic, relational, logical and bitwise operators are explained along with examples.
This document provides an introduction to the Python programming language. It discusses Python's design philosophy emphasizing readability. It also covers printing messages, reading input, variables and data types, operators, and basic syntax like comments and identifiers. Arithmetic, relational, logical and bitwise operators are explained along with examples.
This presentation provides the information on python including the topics Python features, applications, variables and operators in python, control statements, numbers, strings, print formatting, list and list comprehension, dictionaries, tuples, files, sets, boolean, mehtods and functions, lambda expressions and a sample project using Python.
Functions allow programmers to organize and structure their code by splitting it into reusable blocks. There are two types of functions: built-in functions that are predefined in Python, and user-defined functions that programmers create. Functions make code easier to debug, test and maintain by dividing programs into separate, reusable parts. Functions can take arguments as input and return values. Function definitions do not alter the normal flow of a program's execution, but calling a function causes the program flow to jump to the function code and then return to pick up where it left off.
Chapter 1 Class 12 Computer Science Unit 1ssusera7a08a
The document discusses the basics of Python programming language. It provides an introduction to Python, describing how it is an interpreted, high-level and general-purpose programming language. It then covers Python features, data types, operators, and how to work in both interactive and script modes in Python. The document also discusses topics like variables, data handling, arithmetic operators, comparison operators, and more with examples.
This document provides an agenda and overview for a Python training course. The agenda covers key Python topics like dictionaries, conditional statements, loops, functions, modules, input/output, error handling, object-oriented programming and more. The introduction section explains that Python is an interpreted, interactive and object-oriented language well-suited for beginners. It also outlines features like rapid development, automatic memory management and support for procedural and object-oriented programming. The document concludes by explaining Python's core data types including numbers, strings, lists, tuples and dictionaries.
The document discusses Python programming language. It provides an introduction to Python, describing it as an interpreted, high-level and general-purpose programming language. It then covers various data types in Python including numbers, strings, booleans, lists, tuples, sets and dictionaries. The document also discusses operators in Python like arithmetic, comparison, logical and bitwise operators. Finally, it explains how to work with Python in both interactive and script modes.
The document discusses functions in Python. It defines a function as a block of code that performs a specific task and only runs when called. Functions can take parameters as input and return values. Some key points covered include:
- User-defined functions can be created in Python in addition to built-in functions.
- Functions make code reusable, readable, and modular. They allow for easier testing and maintenance of code.
- Variables can have local, global, or non-local scope depending on where they are used.
- Functions can take positional/required arguments, keyword arguments, default arguments, and variable length arguments.
- Objects passed to functions can be mutable like lists, causing pass by
The document discusses Python objects and data types. It covers strings, numbers, lists, tuples, and other basic data types in Python. Strings can be indexed and sliced, and operations like concatenation and length calculation can be performed on strings. Lists and tuples are sequence data types that allow ordered collections of elements. Numbers support arithmetic operators and can include integers, floats, complexes, decimals, and rationals.
This document discusses functions in Python. It begins by defining what a function is - a block of code that performs a specific task and only runs when called. User-defined functions can be created in Python. The document outlines the advantages of using functions such as code reusability and readability. It provides an example of defining and calling a simple function. It also discusses variable scope in functions, including local, global, and nonlocal variables. Finally, it covers passing different data types like numbers, lists, dictionaries and strings to functions.
This document discusses functions in Python. It begins by defining what a function is - a block of code that performs a specific task and only runs when called. User-defined functions can be created in Python. The document outlines the advantages of using functions such as code reusability and readability. It provides an example of defining and calling a simple function. It discusses variable scope within functions and different types of arguments that can be passed to functions. The document also covers passing different data types like lists, dictionaries and strings to functions. Finally, it discusses using functions from library modules like math and string functions.
This document provides an introduction and overview of the Python programming language. It describes Python as a general-purpose, object-oriented programming language with features like high-level programming capabilities, an easily understandable syntax, portability, and being easy to learn. It then discusses Python's characteristics like being an interpreted language, supporting object-oriented programming, being interactive and easy to use, having straightforward syntax, being portable, extendable, and scalable. The document also outlines some common uses of Python like for creating web and desktop applications, and provides examples of using Python's interactive and script modes.
This document provides an overview of the Python programming language. It discusses Python's history and evolution, its key features like being object-oriented, open source, portable, having dynamic typing and built-in types/tools. It also covers Python's use for numeric processing with libraries like NumPy and SciPy. The document explains how to use Python interactively from the command line and as scripts. It describes Python's basic data types like integers, floats, strings, lists, tuples and dictionaries as well as common operations on these types.
The document provides an overview of the history and basics of C++ programming. It discusses:
- Bjarne Stroustrup created C++ in the early 1980s as an extension of C to support object-oriented programming.
- A typical C++ environment includes a program development environment, the C++ language itself, and the C++ Standard Library.
- A C++ program goes through several phases: edit, preprocess, compile, link, load, and execute.
- Basic C++ concepts covered include variables, data types, operators, and common errors.
The document provides an overview of the Python programming language. It discusses what Python is, its history and naming, features like being dynamically typed and interpreted, popular applications like web development, machine learning, and its architecture. It also covers Python constructs like variables, data types, operators, and strings. The document compares Python to other languages and provides examples of common Python concepts.
The document provides an introduction and tutorial to the Python programming language. It covers 13 chapters that introduce very basic Python concepts up to more advanced topics like classes and CGI programming. The chapters include variables, data types, operators, conditionals, functions, iteration, strings, collection data types, exception handling, modules, files, documentation, and classes. The document also notes several sources that were used to create the tutorial and provides example code snippets throughout to demonstrate the concepts discussed.
This document provides an overview of the C programming language. It discusses that C was developed in 1972 at Bell Labs and is a popular systems and applications programming language. The document then covers various C language concepts like data types, variables, operators, input/output functions, and provides examples of basic C programs and code snippets.
Python is an open source, general-purpose programming language that is easy to use and learn. It supports object-oriented programming and has extensive libraries for tasks like working with arrays and matrices. Python code is written in plain text and uses whitespace indentation to denote code blocks rather than curly braces. It supports common data types like integers, floats, and strings. Functions are defined using the def keyword and can take arguments. Conditionals, loops, exceptions, and other control flow structures allow Python code to respond dynamically to different situations.
The document provides instructions for running Python code in both interactive and script modes. It explains that in interactive mode, code is executed immediately after being typed, while scripts run entire files of code. Steps are given to start an interactive session in the terminal or IDLE and run script files with Python filename.py. Code examples are also provided to demonstrate basic Python operations in the interactive interpreter like arithmetic, variables, functions, strings and control flow.
The document is a report on the topic of computer programming and utilization prepared by group C. It discusses functions, including the definition of a function, function examples, benefits of functions, function prototypes, function arguments, and recursion. It provides examples of math library functions, global and local variables, and external variables. It also includes examples of recursive functions to calculate factorials and the Fibonacci series recursively.
This document provides an overview of Python basics training. It covers installing Python, running Python code through various methods like the command line, IDLE, and Jupyter notebooks. It also discusses Python syntax, variables, data types, operators, conditional statements, and loops. Key Python data types include integers, floats, strings, lists, and dictionaries. The document is intended as an introduction to Python for beginners.
This document discusses functions in Python. It begins by defining what a function is and provides examples of built-in functions and functions defined in modules. It then lists some advantages of using functions such as code reusability and readability. The document discusses the different types of functions - built-in functions, functions defined in modules, and user-defined functions. It provides examples of each type. The document also covers topics such as function parameters, return values, variable scope, lambda functions, and using functions from libraries.
The document discusses functions in Python. It defines a function as a block of code that performs a specific task and only runs when called. There are three types of functions: built-in functions, functions defined in modules, and user-defined functions. Functions can take parameters and return values. Variables used in functions can have local, global, or nonlocal scope. Functions allow for code reusability and modularity.
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPRAHUL
This Dissertation explores the particular circumstances of Mirzapur, a region located in the
core of India. Mirzapur, with its varied terrains and abundant biodiversity, offers an optimal
environment for investigating the changes in vegetation cover dynamics. Our study utilizes
advanced technologies such as GIS (Geographic Information Systems) and Remote sensing to
analyze the transformations that have taken place over the course of a decade.
The complex relationship between human activities and the environment has been the focus
of extensive research and worry. As the global community grapples with swift urbanization,
population expansion, and economic progress, the effects on natural ecosystems are becoming
more evident. A crucial element of this impact is the alteration of vegetation cover, which plays a
significant role in maintaining the ecological equilibrium of our planet.Land serves as the foundation for all human activities and provides the necessary materials for
these activities. As the most crucial natural resource, its utilization by humans results in different
'Land uses,' which are determined by both human activities and the physical characteristics of the
land.
The utilization of land is impacted by human needs and environmental factors. In countries
like India, rapid population growth and the emphasis on extensive resource exploitation can lead
to significant land degradation, adversely affecting the region's land cover.
Therefore, human intervention has significantly influenced land use patterns over many
centuries, evolving its structure over time and space. In the present era, these changes have
accelerated due to factors such as agriculture and urbanization. Information regarding land use and
cover is essential for various planning and management tasks related to the Earth's surface,
providing crucial environmental data for scientific, resource management, policy purposes, and
diverse human activities.
Accurate understanding of land use and cover is imperative for the development planning
of any area. Consequently, a wide range of professionals, including earth system scientists, land
and water managers, and urban planners, are interested in obtaining data on land use and cover
changes, conversion trends, and other related patterns. The spatial dimensions of land use and
cover support policymakers and scientists in making well-informed decisions, as alterations in
these patterns indicate shifts in economic and social conditions. Monitoring such changes with the
help of Advanced technologies like Remote Sensing and Geographic Information Systems is
crucial for coordinated efforts across different administrative levels. Advanced technologies like
Remote Sensing and Geographic Information Systems
9
Changes in vegetation cover refer to variations in the distribution, composition, and overall
structure of plant communities across different temporal and spatial scales. These changes can
occur natural.
The document discusses Python programming language. It provides an introduction to Python, describing it as an interpreted, high-level and general-purpose programming language. It then covers various data types in Python including numbers, strings, booleans, lists, tuples, sets and dictionaries. The document also discusses operators in Python like arithmetic, comparison, logical and bitwise operators. Finally, it explains how to work with Python in both interactive and script modes.
The document discusses functions in Python. It defines a function as a block of code that performs a specific task and only runs when called. Functions can take parameters as input and return values. Some key points covered include:
- User-defined functions can be created in Python in addition to built-in functions.
- Functions make code reusable, readable, and modular. They allow for easier testing and maintenance of code.
- Variables can have local, global, or non-local scope depending on where they are used.
- Functions can take positional/required arguments, keyword arguments, default arguments, and variable length arguments.
- Objects passed to functions can be mutable like lists, causing pass by
The document discusses Python objects and data types. It covers strings, numbers, lists, tuples, and other basic data types in Python. Strings can be indexed and sliced, and operations like concatenation and length calculation can be performed on strings. Lists and tuples are sequence data types that allow ordered collections of elements. Numbers support arithmetic operators and can include integers, floats, complexes, decimals, and rationals.
This document discusses functions in Python. It begins by defining what a function is - a block of code that performs a specific task and only runs when called. User-defined functions can be created in Python. The document outlines the advantages of using functions such as code reusability and readability. It provides an example of defining and calling a simple function. It also discusses variable scope in functions, including local, global, and nonlocal variables. Finally, it covers passing different data types like numbers, lists, dictionaries and strings to functions.
This document discusses functions in Python. It begins by defining what a function is - a block of code that performs a specific task and only runs when called. User-defined functions can be created in Python. The document outlines the advantages of using functions such as code reusability and readability. It provides an example of defining and calling a simple function. It discusses variable scope within functions and different types of arguments that can be passed to functions. The document also covers passing different data types like lists, dictionaries and strings to functions. Finally, it discusses using functions from library modules like math and string functions.
This document provides an introduction and overview of the Python programming language. It describes Python as a general-purpose, object-oriented programming language with features like high-level programming capabilities, an easily understandable syntax, portability, and being easy to learn. It then discusses Python's characteristics like being an interpreted language, supporting object-oriented programming, being interactive and easy to use, having straightforward syntax, being portable, extendable, and scalable. The document also outlines some common uses of Python like for creating web and desktop applications, and provides examples of using Python's interactive and script modes.
This document provides an overview of the Python programming language. It discusses Python's history and evolution, its key features like being object-oriented, open source, portable, having dynamic typing and built-in types/tools. It also covers Python's use for numeric processing with libraries like NumPy and SciPy. The document explains how to use Python interactively from the command line and as scripts. It describes Python's basic data types like integers, floats, strings, lists, tuples and dictionaries as well as common operations on these types.
The document provides an overview of the history and basics of C++ programming. It discusses:
- Bjarne Stroustrup created C++ in the early 1980s as an extension of C to support object-oriented programming.
- A typical C++ environment includes a program development environment, the C++ language itself, and the C++ Standard Library.
- A C++ program goes through several phases: edit, preprocess, compile, link, load, and execute.
- Basic C++ concepts covered include variables, data types, operators, and common errors.
The document provides an overview of the Python programming language. It discusses what Python is, its history and naming, features like being dynamically typed and interpreted, popular applications like web development, machine learning, and its architecture. It also covers Python constructs like variables, data types, operators, and strings. The document compares Python to other languages and provides examples of common Python concepts.
The document provides an introduction and tutorial to the Python programming language. It covers 13 chapters that introduce very basic Python concepts up to more advanced topics like classes and CGI programming. The chapters include variables, data types, operators, conditionals, functions, iteration, strings, collection data types, exception handling, modules, files, documentation, and classes. The document also notes several sources that were used to create the tutorial and provides example code snippets throughout to demonstrate the concepts discussed.
This document provides an overview of the C programming language. It discusses that C was developed in 1972 at Bell Labs and is a popular systems and applications programming language. The document then covers various C language concepts like data types, variables, operators, input/output functions, and provides examples of basic C programs and code snippets.
Python is an open source, general-purpose programming language that is easy to use and learn. It supports object-oriented programming and has extensive libraries for tasks like working with arrays and matrices. Python code is written in plain text and uses whitespace indentation to denote code blocks rather than curly braces. It supports common data types like integers, floats, and strings. Functions are defined using the def keyword and can take arguments. Conditionals, loops, exceptions, and other control flow structures allow Python code to respond dynamically to different situations.
The document provides instructions for running Python code in both interactive and script modes. It explains that in interactive mode, code is executed immediately after being typed, while scripts run entire files of code. Steps are given to start an interactive session in the terminal or IDLE and run script files with Python filename.py. Code examples are also provided to demonstrate basic Python operations in the interactive interpreter like arithmetic, variables, functions, strings and control flow.
The document is a report on the topic of computer programming and utilization prepared by group C. It discusses functions, including the definition of a function, function examples, benefits of functions, function prototypes, function arguments, and recursion. It provides examples of math library functions, global and local variables, and external variables. It also includes examples of recursive functions to calculate factorials and the Fibonacci series recursively.
This document provides an overview of Python basics training. It covers installing Python, running Python code through various methods like the command line, IDLE, and Jupyter notebooks. It also discusses Python syntax, variables, data types, operators, conditional statements, and loops. Key Python data types include integers, floats, strings, lists, and dictionaries. The document is intended as an introduction to Python for beginners.
This document discusses functions in Python. It begins by defining what a function is and provides examples of built-in functions and functions defined in modules. It then lists some advantages of using functions such as code reusability and readability. The document discusses the different types of functions - built-in functions, functions defined in modules, and user-defined functions. It provides examples of each type. The document also covers topics such as function parameters, return values, variable scope, lambda functions, and using functions from libraries.
The document discusses functions in Python. It defines a function as a block of code that performs a specific task and only runs when called. There are three types of functions: built-in functions, functions defined in modules, and user-defined functions. Functions can take parameters and return values. Variables used in functions can have local, global, or nonlocal scope. Functions allow for code reusability and modularity.
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPRAHUL
This Dissertation explores the particular circumstances of Mirzapur, a region located in the
core of India. Mirzapur, with its varied terrains and abundant biodiversity, offers an optimal
environment for investigating the changes in vegetation cover dynamics. Our study utilizes
advanced technologies such as GIS (Geographic Information Systems) and Remote sensing to
analyze the transformations that have taken place over the course of a decade.
The complex relationship between human activities and the environment has been the focus
of extensive research and worry. As the global community grapples with swift urbanization,
population expansion, and economic progress, the effects on natural ecosystems are becoming
more evident. A crucial element of this impact is the alteration of vegetation cover, which plays a
significant role in maintaining the ecological equilibrium of our planet.Land serves as the foundation for all human activities and provides the necessary materials for
these activities. As the most crucial natural resource, its utilization by humans results in different
'Land uses,' which are determined by both human activities and the physical characteristics of the
land.
The utilization of land is impacted by human needs and environmental factors. In countries
like India, rapid population growth and the emphasis on extensive resource exploitation can lead
to significant land degradation, adversely affecting the region's land cover.
Therefore, human intervention has significantly influenced land use patterns over many
centuries, evolving its structure over time and space. In the present era, these changes have
accelerated due to factors such as agriculture and urbanization. Information regarding land use and
cover is essential for various planning and management tasks related to the Earth's surface,
providing crucial environmental data for scientific, resource management, policy purposes, and
diverse human activities.
Accurate understanding of land use and cover is imperative for the development planning
of any area. Consequently, a wide range of professionals, including earth system scientists, land
and water managers, and urban planners, are interested in obtaining data on land use and cover
changes, conversion trends, and other related patterns. The spatial dimensions of land use and
cover support policymakers and scientists in making well-informed decisions, as alterations in
these patterns indicate shifts in economic and social conditions. Monitoring such changes with the
help of Advanced technologies like Remote Sensing and Geographic Information Systems is
crucial for coordinated efforts across different administrative levels. Advanced technologies like
Remote Sensing and Geographic Information Systems
9
Changes in vegetation cover refer to variations in the distribution, composition, and overall
structure of plant communities across different temporal and spatial scales. These changes can
occur natural.
This document provides an overview of wound healing, its functions, stages, mechanisms, factors affecting it, and complications.
A wound is a break in the integrity of the skin or tissues, which may be associated with disruption of the structure and function.
Healing is the body’s response to injury in an attempt to restore normal structure and functions.
Healing can occur in two ways: Regeneration and Repair
There are 4 phases of wound healing: hemostasis, inflammation, proliferation, and remodeling. This document also describes the mechanism of wound healing. Factors that affect healing include infection, uncontrolled diabetes, poor nutrition, age, anemia, the presence of foreign bodies, etc.
Complications of wound healing like infection, hyperpigmentation of scar, contractures, and keloid formation.
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
2. Basics of Python Programming
Structure of a python program
Program
|->Module -> main program
| -> functios
| ->libraries
|->Statements -> simple statement
| ->compound statement
|->expressions -> Operators
| -> expressions
|----objects ->data model
Visit : python.mykvs.in for regular updates
3. Python basics
Python 3.0 was released in 2008. Although this version is
supposed to be backward incompatibles, later on many of its
important features have been back ported to be compatible with
version 2.7
Python Character Set
A set of valid characters recognized by python. Python uses the traditional
ASCII character set. The latest version recognizes the Unicode character set.
The ASCII character set is a subset of the Unicode character set.
Letters :– A-Z,a-z
Digits :– 0-9
Special symbols :– Special symbol available over keyboard
White spaces:– blank space,tab,carriage return,new line, form feed
Other characters:- Unicode
Visit : python.mykvs.in for regular updates
4. Input and Output
Visit : python.mykvs.in for regular updates
var1=‘Computer Science'
var2=‘Informatics Practices'
print(var1,' and ',var2,' )
Output :-
Computer Science and Informatics Practices
raw_input() Function In Python allows a user to give input to a program
from a keyboard but in the form of string.
NOTE : raw_input() function is deprecated in python 3
e.g.
age = int(raw_input(‘enter your age’))
percentage = float(raw_input(‘enter percentage’))
input() Function In Python allows a user to give input to a program from a
keyboard but returns the value accordingly.
e.g.
age = int(input(‘enter your age’))
C = age+2 #will not produce any error
NOTE : input() function always enter string value in python 3.so on need
int(),float() function can be used for data conversion.
5. Indentation
Indentation refers to the spaces applied at the
beginning of a code line. In other programming
languages the indentation in code is for readability
only, where as the indentation in Python is very
important.
Python uses indentation to indicate a block of code
or used in block of codes.
E.g.1
if 3 > 2:
print(“Three is greater than two!") //syntax error due to not indented
E.g.2
if 3 > 2:
print(“Three is greater than two!") //indented so no error
Visit : python.mykvs.in for regular updates
6. Token
Smallest individual unit in a program is known as
token.
1. Keywords
2. Identifiers
3. Literals
4. Operators
5. punctuators
Visit : python.mykvs.in for regular updates
7. Keywords
Reserve word of the compiler/interpreter which can’t
be used as identifier.
Visit : python.mykvs.in for regular updates
and exec not
as finally or
assert for pass
break from print
class global raise
continue if return
def import try
del in while
elif is with
else lambda yield
except
8. Identifiers
A Python identifier is a name used to identify a
variable, function, class, module or other object.
* An identifier starts with a letter A to Z or a to z or an
underscore (_) followed by zero or more letters,
underscores and digits (0 to 9).
* Python does not allow special characters
* Identifier must not be a keyword of Python.
* Python is a case sensitive programming language.
Thus, Rollnumber and rollnumber are two different
identifiers in Python.
Some valid identifiers : Mybook, file123, z2td, date_2,
_no
Some invalid identifier : 2rno,break,my.book,data-cs
Visit : python.mykvs.in for regular updates
9. Identifiers-continue
Some additional naming conventions
1. Class names start with an uppercase letter. All other
identifiers start with a lowercase letter.
2. Starting an identifier with a single leading
underscore indicates that the identifier is private.
3. Starting an identifier with two leading underscores
indicates a strong private identifier.
4. If the identifier also ends with two trailing
underscores, the identifier is a language-defined
special name.
Visit : python.mykvs.in for regular updates
10. Literals
Literals in Python can be defined as number, text, or
other data that represent values to be stored in
variables.
Example of String Literals in Python
name = ‘Johni’ , fname =“johny”
Example of Integer Literals in Python(numeric literal)
age = 22
Example of Float Literals in Python(numeric literal)
height = 6.2
Example of Special Literals in Python
name = None
Visit : python.mykvs.in for regular updates
11. Escape sequence/Back slash character constants
Visit : python.mykvs.in for regular updates
Escape Sequence Description
Backslash ()
' Single quote (')
" Double quote (")
a ASCII Bell (BEL)
b ASCII Backspace (BS)
f ASCII Formfeed (FF)
n ASCII Linefeed (LF)
r ASCII Carriage Return (CR)
t ASCII Horizontal Tab (TAB)
v ASCII Vertical Tab (VT)
ooo Character with octal value ooo
xhh Character with hex value hh
Literals
12. Operators
Operators can be defined as symbols that are used to
perform operations on operands.
Types of Operators
1. Arithmetic Operators.
2. Relational Operators.
3. Assignment Operators.
4. Logical Operators.
5. Bitwise Operators
6. Membership Operators
7. Identity Operators
Visit : python.mykvs.in for regular updates
13. Operators continue
Visit : python.mykvs.in for regular updates
1. Arithmetic Operators
Arithmetic Operators are used to perform arithmetic
operations like addition, multiplication, division etc.
Operator
s
Description Example
+ perform addition of two number x=a+b
- perform subtraction of two number x=a-b
/ perform division of two number x=a/b
* perform multiplication of two number x=a*b
% Modulus = returns remainder x=a%b
//
Floor Division = remove digits after the
decimal point
x=a//b
** Exponent = perform raise to power x=a**b
14. Operator continue
Visit : python.mykvs.in for regular updates
Arithmatic operator continue
e.g.
x = 5
y = 4
print('x + y =',x+y)
print('x - y =',x-y)
print('x * y =',x*y)
print('x / y =',x/y)
print('x // y =',x//y)
print('x ** y =',x**y)
OUTPUT
('x + y =', 9)
('x - y =', 1)
('x * y =', 20)
('x / y =', 1)
('x // y =', 1)
('x ** y =', 625)
• Write a program in python to calculate the simple
interest based on entered amount ,rate and time
15. Operator continue
Visit : python.mykvs.in for regular updates
Arithmatic operator continue
# EMI Calculator program in Python
def emi_calculator(p, r, t):
r = r / (12 * 100) # one month interest
t = t * 12 # one month period
emi = (p * r * pow(1 + r, t)) / (pow(1 + r, t) - 1)
return emi
# driver code
principal = 10000;
rate = 10;
time = 2;
emi = emi_calculator(principal, rate, time);
print("Monthly EMI is= ", emi)
16. Operator continue
Visit : python.mykvs.in for regular updates
Arithmatic operator continue
How to calculate GST
GST ( Goods and Services Tax ) which is included in
netprice of product for get GST % first need to calculate GST Amount
by subtract original cost from Netprice and then apply
GST % formula = (GST_Amount*100) / original_cost
# Python3 Program to compute GST from original and net prices.
def Calculate_GST(org_cost, N_price):
# return value after calculate GST%
return (((N_price - org_cost) * 100) / org_cost);
# Driver program to test above functions
org_cost = 100
N_price = 120
print("GST = ",end='')
print(round(Calculate_GST(org_cost, N_price)),end='')
print("%")
* Write a Python program to calculate the standard deviation
17. Operators continue
Visit : python.mykvs.in for regular updates
2. Relational Operators/Comparison Operator
Relational Operators are used to compare the values.
Operator
s
Description Example
== Equal to, return true if a equals to b a == b
!=
Not equal, return true if a is not
equals to b
a != b
>
Greater than, return true if a is
greater than b
a > b
>=
Greater than or equal to , return true
if a is greater than b or a is equals to b
a >= b
<
Less than, return true if a is less than
b
a < b
<=
Less than or equal to , return true if a
is less than b or a is equals to b
a <= b
18. Operator continue
Visit : python.mykvs.in for regular updates
Comparison operators continue
e.g.
x = 101
y = 121
print('x > y is',x>y)
print('x < y is',x<y)
print('x == y is',x==y)
print('x != y is',x!=y)
print('x >= y is',x>=y)
print('x <= y is',x<=y)
Output
('x > y is', False)
('x < y is', True)
('x == y is', False)
('x != y is', True)
('x >= y is', False)
('x <= y is', True)
19. Operators continue
Visit : python.mykvs.in for regular updates
3. Assignment Operators
Used to assign values to the variables.
Operators Description Example
= Assigns values from right side operands to left side operand a=b
+= Add 2 numbers and assigns the result to left operand. a+=b
/= Divides 2 numbers and assigns the result to left operand. a/=b
*= Multiply 2 numbers and assigns the result to left operand. A*=b
-= Subtracts 2 numbers and assigns the result to left operand. A-=b
%= modulus 2 numbers and assigns the result to left operand. a%=b
//= Perform floor division on 2 numbers and assigns the result to left operand. a//=b
**= calculate power on operators and assigns the result to left operand. a**=b
20. Operators continue
Visit : python.mykvs.in for regular updates
4. Logical Operators
Logical Operators are used to perform logical
operations on the given two variables or values.
a=30
b=20
if(a==30 and b==20):
print('hello')
Output :-
hello
Operators Description Example
and
return true if both condition are
true
x and y
or
return true if either or both
condition are true
x or y
not reverse the condition not(a>b)
21. Operators continue
Visit : python.mykvs.in for regular updates
6. Membership Operators
The membership operators in Python are used to validate
whether a value is found within a sequence such as such as
strings, lists, or tuples.
E.g.
a = 22
list = [22,99,27,31]
In_Ans = a in list
NotIn_Ans = a not in list
print(In_Ans)
print(NotIn_Ans)
Output :-
True
False
Operato
rs
Description Example
in return true if value exists in the sequence, else false. a in list
not in
return true if value does not exists in the sequence, else
false.
a not in list
22. Operators continue
Visit : python.mykvs.in for regular updates
7. Identity Operators
Identity operators in Python compare the memory locations of
two objects.
e.g.
a = 34
b=34
if (a is b):
print('both a and b has same identity')
else:
print('a and b has different identity')
b=99
if (a is b):
print('both a and b has same identity')
else:
print('a and b has different identity')
Output :-
both a and b has same identity
a and b has different identity
Operato
rs
Description Example
is
returns true if two variables point the same object, else
false
a is b
is not
returns true if two variables point the different object,
else false
a is not b
23. Operator continue
Visit : python.mykvs.in for regular updates
Operators Precedence :
highest precedence to lowest precedence table. Precedence is used to decide
,which operator to be taken first for evaluation when two or more operators comes
in an expression.
Operator Description
** Exponentiation (raise to the power)
~ + - Complement, unary plus,minus(method names for the last two
are+@and -@)
* / % // Multiply, divide, modulo and floor division
+ - Addition and subtraction
>> << Right and left bitwise shift
& Bitwise 'AND'td>
^ | Bitwise exclusive `OR' and regular `OR'
<= < > >= Comparison operators
<> == != Equality operators
= %= /= //= -= += *= **= Assignment operators
is is not Identity operators
in not in Membership operators
not or and Logical operators
24. Punctuators
Visit : python.mykvs.in for regular updates
Used to implement the grammatical and structure of a
Syntax.Following are the python punctuators.
25. Barebone of a python program
Visit : python.mykvs.in for regular updates
#function definition comment
def keyArgFunc(empname, emprole):
print ("Emp Name: ", empname) Function
print ("Emp Role: ", emprole) indentation
return;
A = 20 expression
print("Calling in proper sequence")
keyArgFunc(empname = "Nick",emprole = "Manager" )
print("Calling in opposite sequence") statements
keyArgFunc(emprole = "Manager",empname = "Nick")
A python program contain the following components
a. Expression
b. Statement
c. Comments
d. Function
e. Block &n indentation
26. Barebone of a python program
Visit : python.mykvs.in for regular updates
a. Expression : - which is evaluated and produce result. E.g. (20 + 4) / 4
b. Statement :- instruction that does something.
e.g
a = 20
print("Calling in proper sequence")
c. Comments : which is readable for programmer but ignored by python
interpreter
i. Single line comment: Which begins with # sign.
ii. Multi line comment (docstring): either write multiple line beginning with
# sign or use triple quoted multiple line. E.g.
‘’’this is my
first
python multiline comment
‘’’
d. Function
a code that has some name and it can be reused.e.g. keyArgFunc in above
program
d. Block & indentation : group of statements is block.indentation at same level
create a block.e.g. all 3 statement of keyArgFunc function
27. Variables
Visit : python.mykvs.in for regular updates
Variable is a name given to a memory location. A variable can
consider as a container which holds value. Python is a type infer
language that means you don't need to specify the datatype of
variable.Python automatically get variable datatype depending
upon the value assigned to the variable.
Assigning Values To Variable
name = ‘python' # String Data Type
sum = None # a variable without value
a = 23 # Integer
b = 6.2 # Float
sum = a + b
print (sum)
Multiple Assignment: assign a single value to many variables
a = b = c = 1 # single value to multiple variable
a,b = 1,2 # multiple value to multiple variable
a,b = b,a # value of a and b is swaped
28. Variables
Visit : python.mykvs.in for regular updates
Variable Scope And Lifetime in Python Program
1. Local Variable
def fun():
x=8
print(x)
fun()
print(x) #error will be shown
2. Global Variable
x = 8
def fun():
print(x) # Calling variable ‘x’ inside fun()
fun()
print(x) # Calling variable ‘x’ outside fun()
29. Dynamic typing
Visit : python.mykvs.in for regular updates
Data type of a variable depend/change upon the value
assigned to a variable on each next statement.
X = 25 # integer type
X = “python” # x variable data type change to string on just
next line
Now programmer should be aware that not to write like
this:
Y = X / 5 # error !! String cannot be devided
30. Constants
Visit : python.mykvs.in for regular updates
A constant is a type of variable whose value cannot be changed. It
is helpful to think of constants as containers that hold
information which cannot be changed later.
In Python, constants are usually declared and assigned in a
module. Here, the module is a new file containing variables,
functions, etc which is imported to the main file. Inside the
module, constants are written in all capital letters and
underscores separating the words.
Create a constant.py:
PI = 3.14
Create a main.py:
import constant
print(constant.PI)
Note: In reality, we can not create constants in Python. Naming them in
all capital letters is a convention to separate them from variables,
however, it does not actually prevent reassignment, so we can change
it’s value
31. Input and Output
Visit : python.mykvs.in for regular updates
print() Function In Python is used to print output on the screen.
Syntax of Print Function - print(expression/variable)
e.g.
print(122)
Output :-
122
print('hello India')
Output :-
hello India
print(‘Computer',‘Science')
print(‘Computer',‘Science',sep=' & ')
print(‘Computer',‘Science',sep=' & ',end='.')
Output :-
Computer Science
Computer & Science
Computer & Science.