Hema New
Hema New
○ Python can be used for simple tasks such as plotting or for more complex tasks like
machine learning
Features Of Python:-
● Easy
● Interpreted
● Object-oriented
● Free and open source
● Portable
● GUI Programming
● Large python library
Variables, Objects, and Classes (cont.)
● A class is a collection of objects
who share the same set of
variables/methods. Instance #1
Color: Pink
Name: Polo
○ The definition of the class provides a Instance #2
blueprint for all the objects within it Color: Red
Name: Mini
(instances).
Instance #3
Color: Blue
○ Instances may share the same Name: Beetle
variables (color, size, shape, etc.), but
they do NOT share the same values
for each variable (blue/red/pink,
small/large, square/circular etc.)
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).
○ 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.
● Basic Syntax:-
● Try Block: Code that may potentially raise an exception is put inside a try
block.
● Example:-
Applications Of Python:-
Certificate:-