SUB NAME: PYTHON PROGRAMMING
SUB CODE: 120C1A
SYLLABUS
Introduction: The essence of computational problem solving –Limits of computational problem solving-
Computer algorithms-Computer Hardware-Computer Software-The process of computational problem
solving-Python programming language -Literals -Variables and Identifiers -Operators -Expressions and
Data types, Input / output.
UNIT-I
UNIT-II
Control Structures: Boolean Expressions -Selection Control -If Statement-Indentation in Python-Multi-Way
Selection --Iterative Control-While Statement-Infinite loops-Definite vs. Indefinite Loops-Boolean Flag. String,
List and Dictionary, Manipulations Building blocks of python programs,Understanding and using ranges.
UNIT-III
Functions: Program Routines-Defining Functions-More on Functions: Calling Value-Returning Functions-
Calling Non-Value-Returning Functions-Parameter Passing -Keyword Arguments in Python -Default
Arguments in Python-Variable Scope. Recursion: Recursive Functions.
UNIT-IV
Objects and their use: Software Objects -Turtle Graphics –Turtle
attributes-Modular Design: Modules -Top-Down Design -Python Modules
-Text Files: Opening, readingand writing text files –Exception Handling.
UNIT-V
Dictionaries and Sets: Dictionary type in Python -Set Data type. Object
Oriented Programming using Python: Encapsulation -Inheritance –
Polymorphism. Python packages: Simple programs using the built-in
functions of packages matplotlib, NumPy, pandas etc.
What is Python?
● Python is a popular high-level programming language used in various
applications
○ Python is an easy language to learn because of its simple syntax
○ Python can be used for simple tasks such as plotting or for more complex tasks like
machine learning
Variables, Objects, and Classes
● A variable is a reference to a value stored in a computer’s memory.
● Variables can be sorted into a variety of categories (or data types) such
as numbers (int/float etc), Boolean values (true/false), and
sequences (strings, lists etc).
● An object is a collection of data from a computer’s memory that can be
manipulated.
○ ALL VARIABLES ARE OBJECTS although some objects can be defined by data
referred to by multiple variables.
○ Methods are the functions used to act on/alter an object’s data. They
describe what your object can “do.”
Variables, Objects, and Classes (cont.)
● A class is a collection of objects
who share the same set of
variables/methods.
○ The definition of the class provides a
blueprint for all the objects within it
(instances).
○ Instances may share the same
variables (color, size, shape, etc.), but
they do NOT share the same values
for each variable (blue/red/pink,
small/large, square/circular etc.)
Instance #1
Color: Pink
Name: Polo
Instance #2
Color: Red
Name: Mini
Instance #3
Color: Blue
Name: Beetle
Basic Syntax Rules
● The name of your variable (myInt etc.) is placed on the left of the “=“ operator.
○ Most variable names are in camel case where the first word begins with a lowercase letter and any subsequent words
are capitalized
○ Variable names may also appear in snake case where all words are lowercase, with underscores between words
● The assignment operator (“=“) sets the variable name equal to the memory location where your value is found.
● The value of your variable (“Hello, World”) is placed on the right of the “=“ operator.
○ The type of this value does NOT need to be stated but its format must abide by a given object type (as shown).
myString = “Hello, World” myInt = 7
myFloat = 7.0
myList = [7, 8, 9] myBoolean = true
Basic Syntax Rules
● Function Syntax
○ def...: indicates that you are defining a new function.
○ function() refers to the name of your function. By convention, this name is typically lowercase and represents a verb/action.
○ a,b refers to parameters (values or variables) that can be used within the statements of your function’s definition (......). If
your function has no parameters, an empty parenthetical () is used.
○ The return statement is an optional statement that will return a value for your function to your original call.
def function(a, b):
......
return a + b
Basic Syntax Rules (cont.)
● Calling a function
○ Call the function by referring to its name (function()) and by placing
any necessary arguments (1, 2) within the parenthesis separated by
commas. myValue = function(1, 2)
○ If you wish, you can set your function call equal to a variable (myValue). The value
returned by the function will be assigned to your variable name.
myValue = function(1, 2)
Common Data Types and Operators
● A data type is a means of classifying a value and determining what operations can
be performed on it. All objects have a data type.
● Operators are symbols used carry out specific functions/computations.
● https://www.youtube.com/watch?v=v5MR5JnKcZI
Input/Output
● Input functions (input()) allow users of a program to place values into
programming code.
○ The parameter for an input function is called a prompt. This is a
string (this can be indicated by “” or ‘’) such as “Enter a number: “
○ The user’s response to the prompt will be returned to the input
statement call as a string. To use this value as any other data
type, it must be converted with another function (int()).
● Print functions (print()) allow programs to output strings to users on a
given interface.
○ The parameter of this function is of any type. All types will
automatically be converted to strings.
xString = input(“Enter a number: “)
x = int(xString)
y=x+2
print(y)
If-else Statements
● If-else statements allow programmers to adapt the function of their
code based on a given condition.
● If a given condition (i.e. x % 2 == 0) is true, then the statements
following the if statement (if) will be executed. If the condition is false,
the statements following the else statement (else) will be executed.
○ The condition is tested using the Boolean operators == (is equal
to), != (is not equal to), and (used to test multiple conditions),
and or (used to test if AT LEAST ONE condition is true).
○ Additionally, else-if statements (elif) can be used to provide
unique coding statements for multiple conditions.
xString = input(“Enter a number: “)
x = int(xString)
if x % 2 == 0:
print(“This is an even number”)
elif x == 0:
print(“This number equals 0”)
else:
print(“This is an odd number”)
For Loops
● For loops perform the same task (iterate) for the number of
times specified by an iterable (something that can be evaluated
repeatedly such as a list, string, or range).
● for defines the for loop
● x is the variable defining the number of times the statements
within the loop (print(myInt)) are executed.
● The range(start, stop, step) function is often used to define x.
○ The starting value is defined by start, the final value is
defined by stop – 1, and the magnitude at which x
changes between loops is defined by step.
● in is a Boolean operator that returns true if the given value (x) is
found within a given list, string, range etc.
myString = input(“Enter a number: “)
myInt = int(myString)
for x in range(0, 5, 1): print(myInt)
While Loops
● While loops are statements that iterate so long as a given
Boolean condition is met.
○ x (the variable determining whether or not the
condition is met) is defined and manipulated
OUTSIDE of the header of the while loop (while)
○ The condition (x < 5) is a statement containing a
Boolean variable.
○ break is a statement used to exit the current
for/while loop.
○ continue is a statement used to reject all
statements in the current for/while loop iteration
and return to the beginning of the loop.
myString = input(“Enter a number: “)
myInt = int(myString)
x = 0
while x < 5:
print(myInt)
x= x +1
PYTHON Introduction 1Deep learning 2.pptx

More Related Content

PPTX
What is python-presentation FOR CLASS 10.pptx
PPTX
What is python-presentation FOR CLASS 10.pptx
PPTX
What is Paython.pptx
PPTX
what-is-python-presentation.pptx
PPTX
python-presentation.pptx
PPTX
Problem Solving and Python Programming PPT.This will be helpfull for first ye...
PPTX
Intro to python programming (basics) in easy language
PPTX
uom-2552-what-is-python-presentationalllllll.pptx
What is python-presentation FOR CLASS 10.pptx
What is python-presentation FOR CLASS 10.pptx
What is Paython.pptx
what-is-python-presentation.pptx
python-presentation.pptx
Problem Solving and Python Programming PPT.This will be helpfull for first ye...
Intro to python programming (basics) in easy language
uom-2552-what-is-python-presentationalllllll.pptx

Similar to PYTHON Introduction 1Deep learning 2.pptx (20)

PPTX
uom-2552-what-is-python-presentation.pptx
PPTX
uom-2552-what-is-python-presentation (1).pptx
PPTX
Introduction of python Introduction of python Introduction of python
PPTX
python-presentationpython-presentationpython-presentation.pptx
PPTX
Presentation of Python Programming Language
PPTX
Introduction to Python Programming language
PPTX
Python Programming - Variables, Objects and Classes
PPTX
python-presentation basic for coding.pptx
PPTX
Integrating Python with SQL (12345).pptx
PPTX
PYTHON PPT.pptx python is very useful for day to day life
PPTX
Unit_I-Introduction python programming (1).pptx
PDF
functions- best.pdf
PPTX
Programming in C sesion 2
PPTX
IMP PPT- Python programming fundamentals.pptx
PPTX
Python Revision Tour.pptx class 12 python notes
PPTX
1P13 Python Review Session Covering various Topics
PPTX
Chapter 2-Python and control flow statement.pptx
PPTX
An Introduction : Python
PPTX
PPt Revision of the basics of python1.pptx
PPTX
uom-2552-what-is-python-presentation.pptx
uom-2552-what-is-python-presentation (1).pptx
Introduction of python Introduction of python Introduction of python
python-presentationpython-presentationpython-presentation.pptx
Presentation of Python Programming Language
Introduction to Python Programming language
Python Programming - Variables, Objects and Classes
python-presentation basic for coding.pptx
Integrating Python with SQL (12345).pptx
PYTHON PPT.pptx python is very useful for day to day life
Unit_I-Introduction python programming (1).pptx
functions- best.pdf
Programming in C sesion 2
IMP PPT- Python programming fundamentals.pptx
Python Revision Tour.pptx class 12 python notes
1P13 Python Review Session Covering various Topics
Chapter 2-Python and control flow statement.pptx
An Introduction : Python
PPt Revision of the basics of python1.pptx
Ad

Recently uploaded (20)

PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
advance database management system book.pdf
PDF
What if we spent less time fighting change, and more time building what’s rig...
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PDF
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PDF
Hazard Identification & Risk Assessment .pdf
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PPTX
TNA_Presentation-1-Final(SAVE)) (1).pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
A powerpoint presentation on the Revised K-10 Science Shaping Paper
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
History, Philosophy and sociology of education (1).pptx
FORM 1 BIOLOGY MIND MAPS and their schemes
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Weekly quiz Compilation Jan -July 25.pdf
advance database management system book.pdf
What if we spent less time fighting change, and more time building what’s rig...
Unit 4 Computer Architecture Multicore Processor.pptx
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
Hazard Identification & Risk Assessment .pdf
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
TNA_Presentation-1-Final(SAVE)) (1).pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Ad

PYTHON Introduction 1Deep learning 2.pptx

  • 1. SUB NAME: PYTHON PROGRAMMING SUB CODE: 120C1A
  • 2. SYLLABUS Introduction: The essence of computational problem solving –Limits of computational problem solving- Computer algorithms-Computer Hardware-Computer Software-The process of computational problem solving-Python programming language -Literals -Variables and Identifiers -Operators -Expressions and Data types, Input / output. UNIT-I UNIT-II Control Structures: Boolean Expressions -Selection Control -If Statement-Indentation in Python-Multi-Way Selection --Iterative Control-While Statement-Infinite loops-Definite vs. Indefinite Loops-Boolean Flag. String, List and Dictionary, Manipulations Building blocks of python programs,Understanding and using ranges. UNIT-III Functions: Program Routines-Defining Functions-More on Functions: Calling Value-Returning Functions- Calling Non-Value-Returning Functions-Parameter Passing -Keyword Arguments in Python -Default Arguments in Python-Variable Scope. Recursion: Recursive Functions.
  • 3. UNIT-IV Objects and their use: Software Objects -Turtle Graphics –Turtle attributes-Modular Design: Modules -Top-Down Design -Python Modules -Text Files: Opening, readingand writing text files –Exception Handling. UNIT-V Dictionaries and Sets: Dictionary type in Python -Set Data type. Object Oriented Programming using Python: Encapsulation -Inheritance – Polymorphism. Python packages: Simple programs using the built-in functions of packages matplotlib, NumPy, pandas etc.
  • 4. What is Python? ● Python is a popular high-level programming language used in various applications ○ Python is an easy language to learn because of its simple syntax ○ Python can be used for simple tasks such as plotting or for more complex tasks like machine learning
  • 5. Variables, Objects, and Classes ● A variable is a reference to a value stored in a computer’s memory. ● Variables can be sorted into a variety of categories (or data types) such as numbers (int/float etc), Boolean values (true/false), and sequences (strings, lists etc). ● An object is a collection of data from a computer’s memory that can be manipulated. ○ ALL VARIABLES ARE OBJECTS although some objects can be defined by data referred to by multiple variables. ○ Methods are the functions used to act on/alter an object’s data. They describe what your object can “do.”
  • 6. Variables, Objects, and Classes (cont.) ● A class is a collection of objects who share the same set of variables/methods. ○ The definition of the class provides a blueprint for all the objects within it (instances). ○ Instances may share the same variables (color, size, shape, etc.), but they do NOT share the same values for each variable (blue/red/pink, small/large, square/circular etc.) Instance #1 Color: Pink Name: Polo Instance #2 Color: Red Name: Mini Instance #3 Color: Blue Name: Beetle
  • 7. Basic Syntax Rules ● The name of your variable (myInt etc.) is placed on the left of the “=“ operator. ○ Most variable names are in camel case where the first word begins with a lowercase letter and any subsequent words are capitalized ○ Variable names may also appear in snake case where all words are lowercase, with underscores between words ● The assignment operator (“=“) sets the variable name equal to the memory location where your value is found. ● The value of your variable (“Hello, World”) is placed on the right of the “=“ operator. ○ The type of this value does NOT need to be stated but its format must abide by a given object type (as shown). myString = “Hello, World” myInt = 7 myFloat = 7.0 myList = [7, 8, 9] myBoolean = true
  • 8. Basic Syntax Rules ● Function Syntax ○ def...: indicates that you are defining a new function. ○ function() refers to the name of your function. By convention, this name is typically lowercase and represents a verb/action. ○ a,b refers to parameters (values or variables) that can be used within the statements of your function’s definition (......). If your function has no parameters, an empty parenthetical () is used. ○ The return statement is an optional statement that will return a value for your function to your original call. def function(a, b): ...... return a + b
  • 9. Basic Syntax Rules (cont.) ● Calling a function ○ Call the function by referring to its name (function()) and by placing any necessary arguments (1, 2) within the parenthesis separated by commas. myValue = function(1, 2) ○ If you wish, you can set your function call equal to a variable (myValue). The value returned by the function will be assigned to your variable name. myValue = function(1, 2)
  • 10. Common Data Types and Operators ● A data type is a means of classifying a value and determining what operations can be performed on it. All objects have a data type. ● Operators are symbols used carry out specific functions/computations. ● https://www.youtube.com/watch?v=v5MR5JnKcZI
  • 11. Input/Output ● Input functions (input()) allow users of a program to place values into programming code. ○ The parameter for an input function is called a prompt. This is a string (this can be indicated by “” or ‘’) such as “Enter a number: “ ○ The user’s response to the prompt will be returned to the input statement call as a string. To use this value as any other data type, it must be converted with another function (int()). ● Print functions (print()) allow programs to output strings to users on a given interface. ○ The parameter of this function is of any type. All types will automatically be converted to strings. xString = input(“Enter a number: “) x = int(xString) y=x+2 print(y)
  • 12. If-else Statements ● If-else statements allow programmers to adapt the function of their code based on a given condition. ● If a given condition (i.e. x % 2 == 0) is true, then the statements following the if statement (if) will be executed. If the condition is false, the statements following the else statement (else) will be executed. ○ The condition is tested using the Boolean operators == (is equal to), != (is not equal to), and (used to test multiple conditions), and or (used to test if AT LEAST ONE condition is true). ○ Additionally, else-if statements (elif) can be used to provide unique coding statements for multiple conditions. xString = input(“Enter a number: “) x = int(xString) if x % 2 == 0: print(“This is an even number”) elif x == 0: print(“This number equals 0”) else: print(“This is an odd number”)
  • 13. For Loops ● For loops perform the same task (iterate) for the number of times specified by an iterable (something that can be evaluated repeatedly such as a list, string, or range). ● for defines the for loop ● x is the variable defining the number of times the statements within the loop (print(myInt)) are executed. ● The range(start, stop, step) function is often used to define x. ○ The starting value is defined by start, the final value is defined by stop – 1, and the magnitude at which x changes between loops is defined by step. ● in is a Boolean operator that returns true if the given value (x) is found within a given list, string, range etc. myString = input(“Enter a number: “) myInt = int(myString) for x in range(0, 5, 1): print(myInt)
  • 14. While Loops ● While loops are statements that iterate so long as a given Boolean condition is met. ○ x (the variable determining whether or not the condition is met) is defined and manipulated OUTSIDE of the header of the while loop (while) ○ The condition (x < 5) is a statement containing a Boolean variable. ○ break is a statement used to exit the current for/while loop. ○ continue is a statement used to reject all statements in the current for/while loop iteration and return to the beginning of the loop. myString = input(“Enter a number: “) myInt = int(myString) x = 0 while x < 5: print(myInt) x= x +1