SlideShare a Scribd company logo
1 of 41
What is Python…?
• Python is a general purpose programming language that is often applied in scripting roles.
• So, Python is programming language as well as scripting language.
• Python is also called as Interpreted language
Differences between program and scripting language
a program is executed (i.e.
the source is first compiled,
and the result of that compilation is
expected)
• A "program" in general, is a
sequence of instructions
written so that a computer
can perform certain task.
a script is interpreted
• A "script" is code written in
a scripting language.
A scripting language is nothing
but a type of programming
language in which we can
write code to control
another software application.
What can I do with Python…?
• System programming
• Graphical User Interface Programming
• Internet Scripting
• Component Integration
• Database Programming
• Gaming, Images, XML , Robot and more
Who uses python today…
• Python is being applied in real revenue-generating products by real companies. For
instance:
• Google makes extensive use of Python in its web search system, and employs
Python’s creator.
• Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and IBM use Python for
hardware testing.
• ESRI uses Python as an end-user customization tool for its popular GIS mapping
products.
• The YouTube video sharing service is largely written in Python
Why do people use Python…?
The following primary factors cited by Python users seem to be these:
• Python is object-oriented
Structure supports such concepts as polymorphism, operation overloading, and
multiple inheritance.
.
• It's free (open source)
Downloading and installing Python is free and easy Source code is easily accessible
It's powerful
- Dynamic typing
- Built-in types and tools
- Library utilities
- Third party utilities (e.g. Numeric, NumPy, SciPy)
- Automatic memory management
It's portable
- Python runs virtually every major platform used today
- As long as you have a compatible Python interpreter installed, Python programs will
run in exactly the same manner, irrespective of platform.
• Python programs must be written with a particular
structure. The syntax must be correct, or the
interpreter will generate error messages and not
execute the program.
For example
print(“VKS-Learning Hub“ )
We will consider two ways in which we can run this
statement
• 1. enter the program directly into IDLE’s interactive
shell and
• 2. enter the program into IDLE’s editor, save it, and run
it.
• IDLE’s interactive shell. IDLE is a simple Python integrated
development environment available for Windows, Linux, and Mac
OS X. To start IDLE from the Microsoft Windows Start menu.
The IDLE interactive shell will open with >>> prompt.
You may type the above one line Python program directly
into IDLE and press enter to execute the program.
the result will be display using the IDLE interactive shell.
Since it does not provide a way to save the code you enter, the interactive shell is not the
best tool for writing larger programs. The IDLE interactive shell is useful for
experimenting with small snippets of Python code
IDLE’s editor. IDLE has a built in editor.
From the IDLE menu, select New Window,
Editor will open a file . Type the text print(“Faips Kuwait”) into the editor.
You can save your program using the Save option in the File menu as shown in
Figure. Save the code to a file named try1.py. The extension .py is the extension
used for Python source code.
We can run the program from within the IDLE editor by pressing the F5
function key or from the editor’s Run menu: Run→Run Module. The output
appears in the IDLE interactive shell window.
print(“VKS-Learning Hub")
This is a Python statement. A statement is a command that the interpreter executes. This statement
prints the message VKS-Learning Hub on the screen. A statement is the fundamental unit of
execution in a Python program. Statements may be grouped into larger chunks called blocks, and
blocks can make up more complex statements. Higher-order constructs such as functions and
methods are composed of blocks. The statement print(“VKS-Learning Hub") makes use of a built in
function named print
If you try to enter each line one at a time into the IDLE interactive shell, the program’s
output will be intermingled with the statements you type. In this case the best approach
is to type the program into an editor, save the code you type to a file, and then execute
the program. Most of the time we use an editor to enter and run our Python programs.
The interactive interpreter is most useful for experimenting with small snippets of Python
code.
It is important that no whitespace (spaces or tabs) come before the beginning of each
statement.
In Python the indentation of statements is significant and must be done properly. If
we try to put a single space before a statement in the interactive shell
The interpreter reports a similar error
when we attempt to run a saved Python
program if the code contains such
extraneous indentation.
Values and Variables
Python supports a number of numeric and non-numeric values.
print(16)
• prints the value 16. Notice that unlike “VKS-Learning Hub” no quotation
• marks (") appear in the statement.
• The value 16 is an example of an integer expression. Python supports other
types of expressions besides integer expressions.
• An expression is part of a statement.
• The number 16 by itself is not a complete Python statement and, therefore,
cannot be a program. The interpreter, however, can evaluate a Python
expression.
• You may type the enter 16 directly into the interactive interpreter shell:
• The interactive shell attempts to evaluate both expressions and statements. In
this case, the expression 16 evaluates to 16.
• The shell executes what is commonly called the read, eval, print loop. This
means the interactive shell’s sole activity consists of
• 1. reading the text entered by the user,
• 2. attempting to evaluate the user’s input in the context of what the user
has entered up that point, and
• 3. printing its evaluation of the user’s input.
• If the user enters a 16 the shell interprets it as a 16.
• If the user enters x = 10, a statement has has no overall value itself, the shell
prints nothing.
• If the user then enters x, the shell prints the evaluation of x, which is 10.
• If the user next enters y, the shell reports a error because y has not been
defined in a previous interaction.
• Python uses the + symbol with integers to perform normal arithemtic addition,
so the interactive shell can serve as a handy adding machine:
Python recognizes both single quotes (’) and double quotes (") as valid ways to delimit a string value.
If a single quote marks the beginning of a string value, a single quote must delimit the end of the string.
Similarly, the double quotes, if used instead, must appear in pairs.
You may not mix the quotes when representing a string:
All expressions in Python have a type.
The type of an expression indicates the kind of expression it is.
An expression’s type is sometimes denoted as its class.
The built in type function reveals the type of any Python expression:
Constants
• Fixed values such as numbers, letters, and strings
are called “constants” - because their value does
not change
• Numeric constants are as you expect
• String constants use single-quotes (')
or double-quotes (")
Variables
• A variable is a named place in the memory where a
programmer can store data and later retrieve the data using the
variable “name”
• Programmers get to choose the names of the variables
• You can change the contents of a variable in a later statement
12.2x
14y
x = 12.2
y = 14
100
x = 100
Python Variable Name Rules
• Must start with a letter or underscore _
• Must consist of letters and numbers and
underscores
• Case Sensitive
• Good: spam eggs spam23 _speed
• Bad: 23spam #sign var.12
• Different: spam Spam SPAM
Reserved Words
• You can not use reserved words as variable names
/ identifiers
and del for is raise
assert elif from lambda return
break else global not try
class except if or while
continue exec import pass yield
def finally in print
x = 10
This is an assignment statement.
An assignment statement associates a value with a variable.
The key to an assignment statement is the symbol = which is known as the assignment
operator.
The statement assigns the integer value 10 to the variable x. Said another way, this
statement binds the variable named x to the value 10.
A variable may be assigned and reassigned as often as necessary. The type of a variable will
change if it is reassigned an expression of a different type.
• print(x)
This statement prints the variable x’s current value.
Note that the lack of quotation marks here is very important. If x has the value 10, the
statement
print(x)
prints 10, the value of the variable x, but the statement
print('x')
prints x, the message containing the single letter x.
Sentences or Lines
x = 2
x = x + 2
print x
Variable Operator Constant Reserved Word
Assignment Statement
Assignment with expression
Print statement
Assignment Statements
• We assign a value to a variable using the assignment
statement (=)
• An assignment statement consists of an expression on
the right hand side and a variable to store the result
Right side is an expression. Once expression is evaluated, the result is placed in (assigned to) x.
A variable is a memory location used to store a value. The
value stored in a variable can be updated by replacing the old
value (10) with a new value (220).
x = 2 * x * ( 1 + x )
10 220x
Right side is an expression.
Once expression is evaluated,
the result is placed in (assigned
to) the variable on the left side
(i.e. x).
220
A variable is a memory location
used to store a value. The
value stored in a variable can be
updated by replacing the old
value (10) with a new value
(220).
Numeric Expressions
• Because of the lack of
mathematical symbols on
computer keyboards - we use
“computer-speak” to express
the classic math operations
• Asterisk is multiplication
• Exponentiation (raise to a
power) looks different from in
math.
Operator Operation
+ Addition
- Subtraction
* Multiplication
/ Division
** Power
% Remainder
Numeric Expressions
Operator Operation
+ Addition
- Subtraction
*
Multiplicatio
n
/ Division
** Power
% Remainder
Order of Evaluation
• When we string operators together - Python must
know which one to do first
• This is called “operator precedence”
• Which operator “takes precedence” over the others
29
Order of Operations
Operator Operation Precedence
() parentheses 0
** exponentiation 1
* multiplication 2
/ division 2
// int division 2
% remainder 2
+ addition 3
- subtraction 3
Operator Precedence Rules
• Highest precedence rule to lowest precedence
rule
• Parenthesis are always respected
• Exponentiation (raise to a power)
• Multiplication, Division, and Remainder
• Addition and Subtraction
• Left to right
31
The computer scans the expression from
left to right,
first clearing parentheses,
second, evaluating exponentiations from left to right
in the order they are encountered
third, evaluating *, /, //, % from left to right
in the order they are encountered,
fourth, evaluating +, - from left to right
in the order they are encountered
Parenthesis
Power
Multiplication Division Modulus
Addition Subtraction
Left to Right
10 + 2 * 3 -50/ 5* *2
10 + 2 * 3 - 50/25
10 + 6 - 50/25
10 + 6 - 2
16-2=14
Comments in Python
• Anything after a # is ignored by Python
• Why comment?
• Describe what is going to happen in a sequence of code
• Document who wrote the code or other ancillary
information
• Turn off a line of code - perhaps temporarily
34
function use
Str() Converts a number to
a string
int() Converts an object to an
integer and truncates.
round() Converts an object to an
integer and rounds.
float Converts an object to a
float.
Vks python
Vks python
Vks python
Vks python
Vks python
Vks python
Vks python

More Related Content

What's hot

Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical AnalysisMunni28
 
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTHBhavsingh Maloth
 
About Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of PythonAbout Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of PythonInformation Technology
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & RecoveryAkhil Kaushik
 
Chapter 1 1
Chapter 1 1Chapter 1 1
Chapter 1 1bolovv
 
Doppl development iteration #7
Doppl development   iteration #7Doppl development   iteration #7
Doppl development iteration #7Diego Perini
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verQrembiezs Intruder
 
C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1Ali Raza Jilani
 
Python-00 | Introduction and installing
Python-00 | Introduction and installingPython-00 | Introduction and installing
Python-00 | Introduction and installingMohd Sajjad
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.pptTareq Hasan
 
Compiler design and lexical analyser
Compiler design and lexical analyserCompiler design and lexical analyser
Compiler design and lexical analyserabhishek gupta
 
Mastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsMastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsRuth Marvin
 

What's hot (20)

Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical Analysis
 
Unit 2 python
Unit 2 pythonUnit 2 python
Unit 2 python
 
Pc module1
Pc module1Pc module1
Pc module1
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
 
About Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of PythonAbout Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of Python
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & Recovery
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 
I x scripting
I x scriptingI x scripting
I x scripting
 
Chapter 1 1
Chapter 1 1Chapter 1 1
Chapter 1 1
 
Doppl development iteration #7
Doppl development   iteration #7Doppl development   iteration #7
Doppl development iteration #7
 
Compiler construction
Compiler constructionCompiler construction
Compiler construction
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng ver
 
C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1
 
Python-00 | Introduction and installing
Python-00 | Introduction and installingPython-00 | Introduction and installing
Python-00 | Introduction and installing
 
Python
PythonPython
Python
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
 
Compiler design and lexical analyser
Compiler design and lexical analyserCompiler design and lexical analyser
Compiler design and lexical analyser
 
C# - Part 1
C# - Part 1C# - Part 1
C# - Part 1
 
Mastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsMastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_arguments
 

Similar to Vks python

a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxa9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxcigogag569
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonRanjith kumar
 
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdfPy-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdfshetoooelshitany74
 
Python-Certification-Training-Day-1-2.pptx
Python-Certification-Training-Day-1-2.pptxPython-Certification-Training-Day-1-2.pptx
Python-Certification-Training-Day-1-2.pptxmuzammildev46gmailco
 
Help with Pyhon Programming Homework
Help with Pyhon Programming HomeworkHelp with Pyhon Programming Homework
Help with Pyhon Programming HomeworkHelpmeinhomework
 
Python for katana
Python for katanaPython for katana
Python for katanakedar nath
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer muniryaseen
 
Python Basics by Akanksha Bali
Python Basics by Akanksha BaliPython Basics by Akanksha Bali
Python Basics by Akanksha BaliAkanksha Bali
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizeIruolagbePius
 
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
python-online&offline-training-in-kphb-hyderabad (1) (1).pdfpython-online&offline-training-in-kphb-hyderabad (1) (1).pdf
python-online&offline-training-in-kphb-hyderabad (1) (1).pdfKosmikTech1
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdfsamiwaris2
 
علم البيانات - Data Sience
علم البيانات - Data Sience علم البيانات - Data Sience
علم البيانات - Data Sience App Ttrainers .com
 
Introduction To Programming with Python-1
Introduction To Programming with Python-1Introduction To Programming with Python-1
Introduction To Programming with Python-1Syed Farjad Zia Zaidi
 
PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTESNi
 

Similar to Vks python (20)

a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxa9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
 
Python fundamentals
Python fundamentalsPython fundamentals
Python fundamentals
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdfPy-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
 
Python by Rj
Python by RjPython by Rj
Python by Rj
 
Python Module-1.1.pdf
Python Module-1.1.pdfPython Module-1.1.pdf
Python Module-1.1.pdf
 
Python-Certification-Training-Day-1-2.pptx
Python-Certification-Training-Day-1-2.pptxPython-Certification-Training-Day-1-2.pptx
Python-Certification-Training-Day-1-2.pptx
 
Help with Pyhon Programming Homework
Help with Pyhon Programming HomeworkHelp with Pyhon Programming Homework
Help with Pyhon Programming Homework
 
INTERNSHIP REPORT.docx
 INTERNSHIP REPORT.docx INTERNSHIP REPORT.docx
INTERNSHIP REPORT.docx
 
Python for katana
Python for katanaPython for katana
Python for katana
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
 
Python Basics by Akanksha Bali
Python Basics by Akanksha BaliPython Basics by Akanksha Bali
Python Basics by Akanksha Bali
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualize
 
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
python-online&offline-training-in-kphb-hyderabad (1) (1).pdfpython-online&offline-training-in-kphb-hyderabad (1) (1).pdf
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdf
 
Module-1.pptx
Module-1.pptxModule-1.pptx
Module-1.pptx
 
علم البيانات - Data Sience
علم البيانات - Data Sience علم البيانات - Data Sience
علم البيانات - Data Sience
 
Unit -1 CAP.pptx
Unit -1 CAP.pptxUnit -1 CAP.pptx
Unit -1 CAP.pptx
 
Introduction To Programming with Python-1
Introduction To Programming with Python-1Introduction To Programming with Python-1
Introduction To Programming with Python-1
 
PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTES
 

Recently uploaded

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 

Recently uploaded (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

Vks python

  • 1. What is Python…? • Python is a general purpose programming language that is often applied in scripting roles. • So, Python is programming language as well as scripting language. • Python is also called as Interpreted language Differences between program and scripting language a program is executed (i.e. the source is first compiled, and the result of that compilation is expected) • A "program" in general, is a sequence of instructions written so that a computer can perform certain task. a script is interpreted • A "script" is code written in a scripting language. A scripting language is nothing but a type of programming language in which we can write code to control another software application.
  • 2. What can I do with Python…? • System programming • Graphical User Interface Programming • Internet Scripting • Component Integration • Database Programming • Gaming, Images, XML , Robot and more Who uses python today… • Python is being applied in real revenue-generating products by real companies. For instance: • Google makes extensive use of Python in its web search system, and employs Python’s creator. • Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and IBM use Python for hardware testing. • ESRI uses Python as an end-user customization tool for its popular GIS mapping products. • The YouTube video sharing service is largely written in Python
  • 3. Why do people use Python…? The following primary factors cited by Python users seem to be these: • Python is object-oriented Structure supports such concepts as polymorphism, operation overloading, and multiple inheritance. . • It's free (open source) Downloading and installing Python is free and easy Source code is easily accessible It's powerful - Dynamic typing - Built-in types and tools - Library utilities - Third party utilities (e.g. Numeric, NumPy, SciPy) - Automatic memory management It's portable - Python runs virtually every major platform used today - As long as you have a compatible Python interpreter installed, Python programs will run in exactly the same manner, irrespective of platform.
  • 4.
  • 5. • Python programs must be written with a particular structure. The syntax must be correct, or the interpreter will generate error messages and not execute the program. For example print(“VKS-Learning Hub“ ) We will consider two ways in which we can run this statement • 1. enter the program directly into IDLE’s interactive shell and • 2. enter the program into IDLE’s editor, save it, and run it.
  • 6. • IDLE’s interactive shell. IDLE is a simple Python integrated development environment available for Windows, Linux, and Mac OS X. To start IDLE from the Microsoft Windows Start menu. The IDLE interactive shell will open with >>> prompt. You may type the above one line Python program directly into IDLE and press enter to execute the program. the result will be display using the IDLE interactive shell.
  • 7. Since it does not provide a way to save the code you enter, the interactive shell is not the best tool for writing larger programs. The IDLE interactive shell is useful for experimenting with small snippets of Python code IDLE’s editor. IDLE has a built in editor. From the IDLE menu, select New Window, Editor will open a file . Type the text print(“Faips Kuwait”) into the editor. You can save your program using the Save option in the File menu as shown in Figure. Save the code to a file named try1.py. The extension .py is the extension used for Python source code. We can run the program from within the IDLE editor by pressing the F5 function key or from the editor’s Run menu: Run→Run Module. The output appears in the IDLE interactive shell window.
  • 8. print(“VKS-Learning Hub") This is a Python statement. A statement is a command that the interpreter executes. This statement prints the message VKS-Learning Hub on the screen. A statement is the fundamental unit of execution in a Python program. Statements may be grouped into larger chunks called blocks, and blocks can make up more complex statements. Higher-order constructs such as functions and methods are composed of blocks. The statement print(“VKS-Learning Hub") makes use of a built in function named print
  • 9. If you try to enter each line one at a time into the IDLE interactive shell, the program’s output will be intermingled with the statements you type. In this case the best approach is to type the program into an editor, save the code you type to a file, and then execute the program. Most of the time we use an editor to enter and run our Python programs. The interactive interpreter is most useful for experimenting with small snippets of Python code.
  • 10. It is important that no whitespace (spaces or tabs) come before the beginning of each statement. In Python the indentation of statements is significant and must be done properly. If we try to put a single space before a statement in the interactive shell The interpreter reports a similar error when we attempt to run a saved Python program if the code contains such extraneous indentation.
  • 12. Python supports a number of numeric and non-numeric values.
  • 13. print(16) • prints the value 16. Notice that unlike “VKS-Learning Hub” no quotation • marks (") appear in the statement. • The value 16 is an example of an integer expression. Python supports other types of expressions besides integer expressions. • An expression is part of a statement. • The number 16 by itself is not a complete Python statement and, therefore, cannot be a program. The interpreter, however, can evaluate a Python expression. • You may type the enter 16 directly into the interactive interpreter shell:
  • 14. • The interactive shell attempts to evaluate both expressions and statements. In this case, the expression 16 evaluates to 16. • The shell executes what is commonly called the read, eval, print loop. This means the interactive shell’s sole activity consists of • 1. reading the text entered by the user, • 2. attempting to evaluate the user’s input in the context of what the user has entered up that point, and • 3. printing its evaluation of the user’s input. • If the user enters a 16 the shell interprets it as a 16. • If the user enters x = 10, a statement has has no overall value itself, the shell prints nothing. • If the user then enters x, the shell prints the evaluation of x, which is 10. • If the user next enters y, the shell reports a error because y has not been defined in a previous interaction. • Python uses the + symbol with integers to perform normal arithemtic addition, so the interactive shell can serve as a handy adding machine:
  • 15. Python recognizes both single quotes (’) and double quotes (") as valid ways to delimit a string value. If a single quote marks the beginning of a string value, a single quote must delimit the end of the string. Similarly, the double quotes, if used instead, must appear in pairs. You may not mix the quotes when representing a string:
  • 16. All expressions in Python have a type. The type of an expression indicates the kind of expression it is. An expression’s type is sometimes denoted as its class. The built in type function reveals the type of any Python expression:
  • 17. Constants • Fixed values such as numbers, letters, and strings are called “constants” - because their value does not change • Numeric constants are as you expect • String constants use single-quotes (') or double-quotes (")
  • 18. Variables • A variable is a named place in the memory where a programmer can store data and later retrieve the data using the variable “name” • Programmers get to choose the names of the variables • You can change the contents of a variable in a later statement 12.2x 14y x = 12.2 y = 14 100 x = 100
  • 19. Python Variable Name Rules • Must start with a letter or underscore _ • Must consist of letters and numbers and underscores • Case Sensitive • Good: spam eggs spam23 _speed • Bad: 23spam #sign var.12 • Different: spam Spam SPAM
  • 20. Reserved Words • You can not use reserved words as variable names / identifiers and del for is raise assert elif from lambda return break else global not try class except if or while continue exec import pass yield def finally in print
  • 21. x = 10 This is an assignment statement. An assignment statement associates a value with a variable. The key to an assignment statement is the symbol = which is known as the assignment operator. The statement assigns the integer value 10 to the variable x. Said another way, this statement binds the variable named x to the value 10. A variable may be assigned and reassigned as often as necessary. The type of a variable will change if it is reassigned an expression of a different type. • print(x) This statement prints the variable x’s current value. Note that the lack of quotation marks here is very important. If x has the value 10, the statement print(x) prints 10, the value of the variable x, but the statement print('x') prints x, the message containing the single letter x.
  • 22.
  • 23. Sentences or Lines x = 2 x = x + 2 print x Variable Operator Constant Reserved Word Assignment Statement Assignment with expression Print statement
  • 24. Assignment Statements • We assign a value to a variable using the assignment statement (=) • An assignment statement consists of an expression on the right hand side and a variable to store the result Right side is an expression. Once expression is evaluated, the result is placed in (assigned to) x. A variable is a memory location used to store a value. The value stored in a variable can be updated by replacing the old value (10) with a new value (220).
  • 25. x = 2 * x * ( 1 + x ) 10 220x Right side is an expression. Once expression is evaluated, the result is placed in (assigned to) the variable on the left side (i.e. x). 220 A variable is a memory location used to store a value. The value stored in a variable can be updated by replacing the old value (10) with a new value (220).
  • 26. Numeric Expressions • Because of the lack of mathematical symbols on computer keyboards - we use “computer-speak” to express the classic math operations • Asterisk is multiplication • Exponentiation (raise to a power) looks different from in math. Operator Operation + Addition - Subtraction * Multiplication / Division ** Power % Remainder
  • 27. Numeric Expressions Operator Operation + Addition - Subtraction * Multiplicatio n / Division ** Power % Remainder
  • 28. Order of Evaluation • When we string operators together - Python must know which one to do first • This is called “operator precedence” • Which operator “takes precedence” over the others
  • 29. 29 Order of Operations Operator Operation Precedence () parentheses 0 ** exponentiation 1 * multiplication 2 / division 2 // int division 2 % remainder 2 + addition 3 - subtraction 3
  • 30. Operator Precedence Rules • Highest precedence rule to lowest precedence rule • Parenthesis are always respected • Exponentiation (raise to a power) • Multiplication, Division, and Remainder • Addition and Subtraction • Left to right
  • 31. 31 The computer scans the expression from left to right, first clearing parentheses, second, evaluating exponentiations from left to right in the order they are encountered third, evaluating *, /, //, % from left to right in the order they are encountered, fourth, evaluating +, - from left to right in the order they are encountered
  • 32. Parenthesis Power Multiplication Division Modulus Addition Subtraction Left to Right 10 + 2 * 3 -50/ 5* *2 10 + 2 * 3 - 50/25 10 + 6 - 50/25 10 + 6 - 2 16-2=14
  • 33. Comments in Python • Anything after a # is ignored by Python • Why comment? • Describe what is going to happen in a sequence of code • Document who wrote the code or other ancillary information • Turn off a line of code - perhaps temporarily
  • 34. 34 function use Str() Converts a number to a string int() Converts an object to an integer and truncates. round() Converts an object to an integer and rounds. float Converts an object to a float.

Editor's Notes

  1. Like a dog .... food ... food ...