SlideShare a Scribd company logo
Introduction to Python
Vibrant Technologies & computer
“Training Course in Mumbai”
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Contents
• Review: Introduction, Installing & Running.
• Sample Code from Homework 0.
• Names & Assignment
• Containers: Lists, Tuples, Dictionaries
• Mutability
"Vibrant Technology & Computer"
Vashi, Navi mumbai
What is Python?
• A programming language with strong
similarities to PERL, but with powerful
typing and object oriented features.
– Commonly used for producing HTML content
on websites. Great for text files.
– Useful built-in types (lists, dictionaries).
– Clean syntax, powerful extensions.
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Why Python for CSE-391?
• Textbook Code: Very Object Oriented
– Python much less verbose than Java
• AI Processing: Symbolic
– Python’s built-in datatypes for strings, lists, and more.
– Java or C++ require the use of special classes for this.
• AI Processing: Statistical
– Python has strong numeric processing capabilities:
matrix operations, etc.
– Suitable for probability and machine learning code.
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Technical Issues
Installing & Running Python
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Installing Python
• Python is on eniac: /pkg/bin/python
• Python for Win/Mac from www.python.org.
• GUI development environment: IDLE.
Credits:
http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html
"Vibrant Technology & Computer"
Vashi, Navi mumbai
IDLE Development Environment
• Shell for interactive evaluation.
• Text editor with color-coding and smart
indenting for creating python files.
• Menu commands for changing system
settings and running files.
• You’ll see me using IDLE in class.
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Running Interactively on UNIX
On Unix…
% python
>>> 3+3
6
The ‘>>>’ is the Python prompt. In Unix, when
finished, you can use CONTROL+D.
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Running Programs on UNIX
% python filename.py
You can create python files using emacs.
(There’s a special Python editing mode.)
You could even make the *.py file executable
and add the following text to top of the file
to make it runable: #!/pkg/bin/python
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Understanding the Basics
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Look at a sample of code…
x = 34 - 23 # A comment.
y = “Hello” # Another one.
z = 3.45
if z == 3.45 or y == “Hello”:
x = x + 1
y = y + “ World” # String concat.
print x
print y
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Look at a sample of code…
x = 34 - 23 # A comment.
y = “Hello” # Another one.
z = 3.45
if z == 3.45 or y == “Hello”:
x = x + 1
y = y + “ World” # String concat.
print x
print y
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Enough to Understand the Code
• Assignment uses = and comparison uses ==.
• For numbers +-*/% are as expected.
– Special use of + for string concatenation.
– Special use of % for string formatting.
• Logical operators are words (and, or, not)
not symbols (&&, ||, !).
• The basic printing command is “print.”
• First assignment to a variable will create it.
– Variable types don’t need to be declared.
– Python figures out the variable types on its own.
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Basic Datatypes
• Integers (default for numbers)
z = 5 / 2 # Answer is 2, integer division.
• Floats
x = 3.456
• Strings
Can use “” or ‘’ to specify. “abc” ‘abc’ (Same thing.)
Unmatched ones can occur within the string. “matt’s”
Use triple double-quotes for multi-line strings or strings
than contain both ‘ and “ inside of them: “““a‘b“c”””
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Whitespace
• Whitespace is meaningful in Python: especially
indentation and placement of newlines.
– Use a newline to end a line of code.
(Not a semicolon like in C++ or Java.)
(Use  when must go to next line prematurely.)
– No braces { } to mark blocks of code in Python…
Use consistent indentation instead. The first line with a
new indentation is considered outside of the block.
– Often a colon appears at the start of a new block.
(We’ll see this later for function and class definitions.)
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Comments
• Start comments with # – the rest of line is ignored.
• Can include a “documentation string” as the first
line of any new function or class that you define.
• The development environment, debugger, and
other tools use it: it’s good style to include one.
def my_function(x, y):
“““This is the docstring. This
function does blah blah blah.”””
# The code would go here...
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Look at a sample of code…
x = 34 - 23 # A comment.
y = “Hello” # Another one.
z = 3.45
if z == 3.45 or y == “Hello”:
x = x + 1
y = y + “ World” # String concat.
print x
print y
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Understanding Assignment
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Names and References 1
• Python has no pointers like C or C++. Instead, it has
“names” and “references”. (Works a lot like Lisp or Java.)
• You create a name the first time it appears on the left side
of an assignment expression:
x = 3
• Names store “references” which are like pointers to
locations in memory that store a constant or some object.
– Python determines the type of the reference automatically based
on what data is assigned to it.
– It also decides when to delete it via garbage collection after any
names for the reference have passed out of scope.
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Names and References 2
• There is a lot going on when we type:
x = 3
• First, an integer 3 is created and stored in memory.
• A name x is created.
• An reference to the memory location storing the 3
is then assigned to the name x.
Type: Integer
Data: 3
Name: x
Ref: <address1>
name list memory
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Names and References 3
• The data 3 we created is of type integer. In
Python, the basic datatypes integer, float, and
string are “immutable.”
• This doesn’t mean we can’t change the value of
x… For example, we could increment x.
>>> x = 3
>>> x = x + 1
>>> print x
4
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Names and References 4
• If we increment x, then what’s really happening is:
– The reference of name x is looked up.
– The value at that reference is retrieved.
– The 3+1 calculation occurs, producing a new data element 4 which
is assigned to a fresh memory location with a new reference.
– The name x is changed to point to this new reference.
– The old data 3 is garbage collected if no name still refers to it.
Type: Integer
Data: 3Name: x
Ref: <address1>
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Names and References 4
• If we increment x, then what’s really happening is:
– The reference of name x is looked up.
– The value at that reference is retrieved.
– The 3+1 calculation occurs, producing a new data element 4 which
is assigned to a fresh memory location with a new reference.
– The name x is changed to point to this new reference.
– The old data 3 is garbage collected if no name still refers to it.
Type: Integer
Data: 3Name: x
Ref: <address1>
Type: Integer
Data: 4
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Names and References 4
• If we increment x, then what’s really happening is:
– The reference of name x is looked up.
– The value at that reference is retrieved.
– The 3+1 calculation occurs, producing a new data element 4 which
is assigned to a fresh memory location with a new reference.
– The name x is changed to point to this new reference.
– The old data 3 is garbage collected if no name still refers to it.
Type: Integer
Data: 3Name: x
Ref: <address2>
Type: Integer
Data: 4
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Names and References 4
• If we increment x, then what’s really happening is:
– The reference of name x is looked up.
– The value at that reference is retrieved.
– The 3+1 calculation occurs, producing a new data element 4 which
is assigned to a fresh memory location with a new reference.
– The name x is changed to point to this new reference.
– The old data 3 is garbage collected if no name still refers to it.
Name: x
Ref: <address2>
Type: Integer
Data: 4
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Assignment 1
• So, for simple built-in datatypes (integers, floats,
strings), assignment behaves as you would expect:
>>> x = 3 # Creates 3, name x refers to 3
>>> y = x # Creates name y, refers to 3.
>>> y = 4 # Creates ref for 4. Changes y.
>>> print x # No effect on x, still ref 3.
3
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Assignment 1
• So, for simple built-in datatypes (integers, floats,
strings), assignment behaves as you would expect:
>>> x = 3 # Creates 3, name x refers to 3
>>> y = x # Creates name y, refers to 3.
>>> y = 4 # Creates ref for 4. Changes y.
>>> print x # No effect on x, still ref 3.
3
Type: Integer
Data: 3
Name: x
Ref: <address1>
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Assignment 1
• So, for simple built-in datatypes (integers, floats,
strings), assignment behaves as you would expect:
>>> x = 3 # Creates 3, name x refers to 3
>>> y = x # Creates name y, refers to 3.
>>> y = 4 # Creates ref for 4. Changes y.
>>> print x # No effect on x, still ref 3.
3
Type: Integer
Data: 3
Name: x
Ref: <address1>
Name: y
Ref: <address1>
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Assignment 1
• So, for simple built-in datatypes (integers, floats,
strings), assignment behaves as you would expect:
>>> x = 3 # Creates 3, name x refers to 3
>>> y = x # Creates name y, refers to 3.
>>> y = 4 # Creates ref for 4. Changes y.
>>> print x # No effect on x, still ref 3.
3
Type: Integer
Data: 3
Name: x
Ref: <address1>
Type: Integer
Data: 4
Name: y
Ref: <address1>
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Assignment 1
• So, for simple built-in datatypes (integers, floats,
strings), assignment behaves as you would expect:
>>> x = 3 # Creates 3, name x refers to 3
>>> y = x # Creates name y, refers to 3.
>>> y = 4 # Creates ref for 4. Changes y.
>>> print x # No effect on x, still ref 3.
3
Type: Integer
Data: 3
Name: x
Ref: <address1>
Type: Integer
Data: 4
Name: y
Ref: <address2>
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Assignment 1
• So, for simple built-in datatypes (integers, floats,
strings), assignment behaves as you would expect:
>>> x = 3 # Creates 3, name x refers to 3
>>> y = x # Creates name y, refers to 3.
>>> y = 4 # Creates ref for 4. Changes y.
>>> print x # No effect on x, still ref 3.
3
Type: Integer
Data: 3
Name: x
Ref: <address1>
Type: Integer
Data: 4
Name: y
Ref: <address2>
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Assignment 2
• For other data types (lists, dictionaries, user-defined
types), assignment works differently.
– These datatypes are “mutable.”
– When we change these data, we do it in place.
– We don’t copy them into a new memory address each time.
– If we type y=x and then modify y, both x and y are changed!
– We’ll talk more about “mutability” later.
>>> x = 3 x = some mutable object
>>> y = x y = x
>>> y = 4 make a change to y
>>> print x look at x
3 x will be changed as well
immutable mutable
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Container Types in Python
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Container Types
• We’ve talked about integers, floats, and strings…
• Containers are other built-in data types in Python.
– Can hold objects of any type (including their own
type).
– There are three kinds of containers:
Tuples
• A simple immutable ordered sequence of items.
Lists
• Sequence with more powerful manipulations possible.
Dictionaries
• A look-up table of key-value pairs."Vibrant Technology & Computer"
Vashi, Navi mumbai
Tuples, Lists, and Strings:
Similarities
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Similar Syntax
• Tuples and lists are sequential containers that
share much of the same syntax and functionality.
– For conciseness, they will be introduced together.
– The operations shown in this section can be applied to
both tuples and lists, but most examples will just show
the operation performed on one or the other.
• While strings aren’t exactly a container data type,
they also happen to share a lot of their syntax with
lists and tuples; so, the operations you see in this
section can apply to them as well.
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Tuples, Lists, and Strings 1
• Tuples are defined using parentheses (and commas).
>>> tu = (23, ‘abc’, 4.56, (2,3), ‘def’)
• Lists are defined using square brackets (and commas).
>>> li = [“abc”, 34, 4.34, 23]
• Strings are defined using quotes (“, ‘, or “““).
>>> st = “Hello World”
>>> st = ‘Hello World’
>>> st = “““This is a multi-line
string that uses triple quotes.”””
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Tuples, Lists, and Strings 2
• We can access individual members of a tuple, list,
or string using square bracket “array” notation.
>>> tu[1] # Second item in the tuple.
‘abc’
>>> li[1] # Second item in the list.
34
>>> st[1] # Second character in string.
‘e’
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Looking up an Item
>>> t = (23, ‘abc’, 4.56, (2,3), ‘def’)
Positive index: count from the left, starting with 0.
>>> t[1]
‘abc’
Negative lookup: count from right, starting with –1.
>>> t[-3]
4.56
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Slicing: Return Copy of a Subset 1
>>> t = (23, ‘abc’, 4.56, (2,3), ‘def’)
Return a copy of the container with a subset of the
original members. Start copying at the first index,
and stop copying before the second index.
>>> t[1:4]
(‘abc’, 4.56, (2,3))
You can also use negative indices when slicing.
>>> t[1:-1]
(‘abc’, 4.56, (2,3))"Vibrant Technology & Computer"
Vashi, Navi mumbai
Slicing: Return Copy of a Subset 2
>>> t = (23, ‘abc’, 4.56, (2,3), ‘def’)
Omit the first index to make a copy starting from the
beginning of the container.
>>> t[:2]
(23, ‘abc’)
Omit the second index to make a copy starting at the
first index and going to the end of the container.
>>> t[2:]
(4.56, (2,3), ‘def’)"Vibrant Technology & Computer"
Vashi, Navi mumbai
Copying the Whole Container
You can make a copy of the whole tuple using [:].
>>> t[:]
(23, ‘abc’, 4.56, (2,3), ‘def’)
So, there’s a difference between these two lines:
>>> list2 = list1 # 2 names refer to 1 ref
# Changing one affects both
>>> list2 = list1[:] # Two copies, two refs
# They’re independent
"Vibrant Technology & Computer"
Vashi, Navi mumbai
The ‘in’ Operator
• Boolean test whether a value is inside a container:
>>> t = [1, 2, 4, 5]
>>> 3 in t
False
>>> 4 in t
True
>>> 4 not in t
False
• Be careful: the ‘in’ keyword is also used in the
syntax of other unrelated Python constructions:
“for loops” and “list comprehensions.”"Vibrant Technology & Computer"
Vashi, Navi mumbai
The + Operator
• The + operator produces a new tuple, list, or string
whose value is the concatenation of its arguments.
>>> (1, 2, 3) + (4, 5, 6)
(1, 2, 3, 4, 5, 6)
>>> [1, 2, 3] + [4, 5, 6]
[1, 2, 3, 4, 5, 6]
>>> “Hello” + “ ” + “World”
‘Hello World’"Vibrant Technology & Computer"
Vashi, Navi mumbai
The * Operator
• The * operator produces a new tuple, list, or string
that “repeats” the original content.
>>> (1, 2, 3) * 3
(1, 2, 3, 1, 2, 3, 1, 2, 3)
>>> [1, 2, 3] * 3
[1, 2, 3, 1, 2, 3, 1, 2, 3]
>>> “Hello” * 3
‘HelloHelloHello’
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Mutability:
Tuples vs. Lists
What’s the
difference between
tuples and lists?
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Tuples: Immutable
>>> t = (23, ‘abc’, 4.56, (2,3), ‘def’)
>>> t[2] = 3.14
Traceback (most recent call last):
File "<pyshell#75>", line 1, in -toplevel-
tu[2] = 3.14
TypeError: object doesn't support item assignment
You’re not allowed to change a tuple in place in memory; so,
you can’t just change one element of it.
But it’s always OK to make a fresh tuple and assign its
reference to a previously used name.
>>> t = (1, 2, 3, 4, 5)
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Lists: Mutable
>>> li = [‘abc’, 23, 4.34, 23]
>>> li[1] = 45
>>> li
[‘abc’, 45, 4.34, 23]
We can change lists in place. So, it’s ok to change
just one element of a list. Name li still points to the
same memory reference when we’re done.
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Operations on Lists Only 1
• Since lists are mutable (they can be changed
in place in memory), there are many more
operations we can perform on lists than on
tuples.
• The mutability of lists also makes managing
them in memory more complicated… So,
they aren’t as fast as tuples. It’s a tradeoff.
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Operations on Lists Only 2
>>> li = [1, 2, 3, 4, 5]
>>> li.append(‘a’)
>>> li
[1, 2, 3, 4, 5, ‘a’]
>>> li.insert(2, ‘i’)
>>>li
[1, 2, ‘i’, 3, 4, 5, ‘a’]
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Operations on Lists Only 3
The ‘extend’ operation is similar to concatenation with the +
operator. But while the + creates a fresh list (with a new
memory reference) containing copies of the members from
the two inputs, the extend operates on list li in place.
>>> li.extend([9, 8, 7])
>>>li
[1, 2, ‘i’, 3, 4, 5, ‘a’, 9, 8, 7]
Extend takes a list as an argument. Append takes a singleton.
>>> li.append([9, 8, 7])
>>> li
[1, 2, ‘i’, 3, 4, 5, ‘a’, 9, 8, 7, [9, 8, 7]]
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Operations on Lists Only 4
>>> li = [‘a’, ‘b’, ‘c’, ‘b’]
>>> li.index(‘b’) # index of first occurrence
1
>>> li.count(‘b’) # number of occurrences
2
>>> li.remove(‘b’) # remove first occurrence
>>> li
[‘a’, ‘c’, ‘b’]
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Operations on Lists Only 5
>>> li = [5, 2, 6, 8]
>>> li.reverse() # reverse the list *in place*
>>> li
[8, 6, 2, 5]
>>> li.sort() # sort the list *in place*
>>> li
[2, 5, 6, 8]
>>> li.sort(some_function)
# sort in place using user-defined comparison
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Tuples vs. Lists
• Lists slower but more powerful than tuples.
– Lists can be modified, and they have lots of handy
operations we can perform on them.
– Tuples are immutable and have fewer features.
• We can always convert between tuples and lists
using the list() and tuple() functions.
li = list(tu)
tu = tuple(li)
"Vibrant Technology & Computer"
Vashi, Navi mumbai
More About Assignment
Classes,
Functions,
Naming Rules
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Assignment & Mutability 1
• Remember that assignment works differently for
mutable vs. immutable datatypes.
– If you type y=x, then changing y:
…will change x if they are mutable.
…won’t change x if they are immutable.
>>> x = 3 >>> x = [ 1, 2, 3]
>>> y = x >>> y = x
>>> y = y + 1 >>> y.reverse()
>>> print x >>> print x
3 [ 3, 2, 1]
immutable mutable
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Assignment & Mutability 2
Python is object-oriented, and user-defined classes are mutable.
Let’s say that the name x refers to an object of some class.
This class has a “set” and a “get” function for some value.
>>> x.getSomeValue()
4
What happens if we create a new name y and set y=x ?
>>> y = x
This creates a new name y which points to the same memory
reference as the name x. Now, if we make some change to y,
then x will be affected as well.
>>> y.setSomeValue(3)
>>> y.getSomeValue()
3
>>> x.getSomeValue()
3
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Assignment & Mutability 3
• When passing parameters to functions:
– Immutable data types are “call by value.”
– Mutable data types are “call by reference.”
– If you pass mutable data to a function, and you
change it inside that function, the changes will
persist after the function returns.
– Immutable data appear unchanged inside of
functions to which they are passed.
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Naming Rules
• Names are case sensitive and cannot start with a
number. They can contain letters, numbers, and
underscores.
bob Bob _bob _2_bob_ bob_2 BoB
• There are some reserved words:
and, assert, break, class, continue,
def, del, elif, else, except, exec,
finally, for, from, global, if,
import, in, is, lambda, not, or,
pass, print, raise, return, try,
while
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Accessing Non-Existent Name
• If you try to access a name before it’s been
properly created (by placing it on the left side of
an assignment), you’ll get an error.
>>> y
Traceback (most recent call last):
File "<pyshell#16>", line 1, in -toplevel-
y
NameError: name ‘y' is not defined
>>> y = 3
>>> y
3 "Vibrant Technology & Computer"
Vashi, Navi mumbai
Multiple Assignment
• You can also assign to multiple names at the same
time.
>>> x, y = 2, 3
>>> x
2
>>> y
3
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Thank you
Vibrant Technologies
&
computers
Vashi,Navi Mumbai
"Vibrant Technology & Computer"
Vashi, Navi mumbai
Ad

More Related Content

What's hot (20)

Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...
Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...
Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...
Jimmy Lai
 
Text Mining Analytics 101
Text Mining Analytics 101Text Mining Analytics 101
Text Mining Analytics 101
Manohar Swamynathan
 
Scala 3 Is Coming: Martin Odersky Shares What To Know
Scala 3 Is Coming: Martin Odersky Shares What To KnowScala 3 Is Coming: Martin Odersky Shares What To Know
Scala 3 Is Coming: Martin Odersky Shares What To Know
Lightbend
 
Elements of Text Mining Part - I
Elements of Text Mining Part - IElements of Text Mining Part - I
Elements of Text Mining Part - I
Jaganadh Gopinadhan
 
Fundamentals of data structures
Fundamentals of data structuresFundamentals of data structures
Fundamentals of data structures
Niraj Agarwal
 
hands on: Text Mining With R
hands on: Text Mining With Rhands on: Text Mining With R
hands on: Text Mining With R
Jahnab Kumar Deka
 
Ir 09
Ir   09Ir   09
Ir 09
Mohammed Romi
 
Text classification in scikit-learn
Text classification in scikit-learnText classification in scikit-learn
Text classification in scikit-learn
Jimmy Lai
 
Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)
fridolin.wild
 
Stream Based Input Output
Stream Based Input OutputStream Based Input Output
Stream Based Input Output
Bharat17485
 
Text analytics in Python and R with examples from Tobacco Control
Text analytics in Python and R with examples from Tobacco ControlText analytics in Python and R with examples from Tobacco Control
Text analytics in Python and R with examples from Tobacco Control
Ben Healey
 
Real World Haskell: Lecture 3
Real World Haskell: Lecture 3Real World Haskell: Lecture 3
Real World Haskell: Lecture 3
Bryan O'Sullivan
 
Real World Haskell: Lecture 7
Real World Haskell: Lecture 7Real World Haskell: Lecture 7
Real World Haskell: Lecture 7
Bryan O'Sullivan
 
Real World Haskell: Lecture 6
Real World Haskell: Lecture 6Real World Haskell: Lecture 6
Real World Haskell: Lecture 6
Bryan O'Sullivan
 
Real World Haskell: Lecture 4
Real World Haskell: Lecture 4Real World Haskell: Lecture 4
Real World Haskell: Lecture 4
Bryan O'Sullivan
 
Real World Haskell: Lecture 2
Real World Haskell: Lecture 2Real World Haskell: Lecture 2
Real World Haskell: Lecture 2
Bryan O'Sullivan
 
FinalReport
FinalReportFinalReport
FinalReport
Benjamin LeRoy
 
String Handling
String HandlingString Handling
String Handling
Bharat17485
 
Data Structure
Data StructureData Structure
Data Structure
Karthikeyan A K
 
Python ml
Python mlPython ml
Python ml
Shubham Sharma
 
Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...
Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...
Text Classification in Python – using Pandas, scikit-learn, IPython Notebook ...
Jimmy Lai
 
Scala 3 Is Coming: Martin Odersky Shares What To Know
Scala 3 Is Coming: Martin Odersky Shares What To KnowScala 3 Is Coming: Martin Odersky Shares What To Know
Scala 3 Is Coming: Martin Odersky Shares What To Know
Lightbend
 
Elements of Text Mining Part - I
Elements of Text Mining Part - IElements of Text Mining Part - I
Elements of Text Mining Part - I
Jaganadh Gopinadhan
 
Fundamentals of data structures
Fundamentals of data structuresFundamentals of data structures
Fundamentals of data structures
Niraj Agarwal
 
hands on: Text Mining With R
hands on: Text Mining With Rhands on: Text Mining With R
hands on: Text Mining With R
Jahnab Kumar Deka
 
Text classification in scikit-learn
Text classification in scikit-learnText classification in scikit-learn
Text classification in scikit-learn
Jimmy Lai
 
Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)
fridolin.wild
 
Stream Based Input Output
Stream Based Input OutputStream Based Input Output
Stream Based Input Output
Bharat17485
 
Text analytics in Python and R with examples from Tobacco Control
Text analytics in Python and R with examples from Tobacco ControlText analytics in Python and R with examples from Tobacco Control
Text analytics in Python and R with examples from Tobacco Control
Ben Healey
 
Real World Haskell: Lecture 3
Real World Haskell: Lecture 3Real World Haskell: Lecture 3
Real World Haskell: Lecture 3
Bryan O'Sullivan
 
Real World Haskell: Lecture 7
Real World Haskell: Lecture 7Real World Haskell: Lecture 7
Real World Haskell: Lecture 7
Bryan O'Sullivan
 
Real World Haskell: Lecture 6
Real World Haskell: Lecture 6Real World Haskell: Lecture 6
Real World Haskell: Lecture 6
Bryan O'Sullivan
 
Real World Haskell: Lecture 4
Real World Haskell: Lecture 4Real World Haskell: Lecture 4
Real World Haskell: Lecture 4
Bryan O'Sullivan
 
Real World Haskell: Lecture 2
Real World Haskell: Lecture 2Real World Haskell: Lecture 2
Real World Haskell: Lecture 2
Bryan O'Sullivan
 

Viewers also liked (20)

mobile technologies iOS
mobile technologies iOSmobile technologies iOS
mobile technologies iOS
chrisiegers
 
1 seminario business plan che cos'è e a cosa serve
1  seminario business plan  che cos'è e a cosa serve1  seminario business plan  che cos'è e a cosa serve
1 seminario business plan che cos'è e a cosa serve
Intraprendereamodena
 
CPP's Advanced Dispersion Modeling Services
CPP's Advanced Dispersion Modeling ServicesCPP's Advanced Dispersion Modeling Services
CPP's Advanced Dispersion Modeling Services
Sergio A. Guerra
 
Technologies of today
Technologies of todayTechnologies of today
Technologies of today
kagecat
 
Python web frameworks
Python web frameworksPython web frameworks
Python web frameworks
NEWLUG
 
Advanced iOS
Advanced iOSAdvanced iOS
Advanced iOS
Pete Goodliffe
 
Advanced Technologies in Architecture
Advanced Technologies in ArchitectureAdvanced Technologies in Architecture
Advanced Technologies in Architecture
Isidro Navarro
 
1.3 applications, issues
1.3 applications, issues1.3 applications, issues
1.3 applications, issues
Krish_ver2
 
Advanced Python, Part 1
Advanced Python, Part 1Advanced Python, Part 1
Advanced Python, Part 1
Zaar Hai
 
C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)
Michael Redlich
 
Advanced Python Techniques: Decorators
Advanced Python Techniques: DecoratorsAdvanced Python Techniques: Decorators
Advanced Python Techniques: Decorators
Tomo Popovic
 
Server-side Technologies in Java
Server-side Technologies in JavaServer-side Technologies in Java
Server-side Technologies in Java
Anirban Majumdar
 
Python and BIG Data analytics | Python Fundamentals | Python Architecture
Python and BIG Data analytics | Python Fundamentals | Python ArchitecturePython and BIG Data analytics | Python Fundamentals | Python Architecture
Python and BIG Data analytics | Python Fundamentals | Python Architecture
Skillspeed
 
Major issues in data mining
Major issues in data miningMajor issues in data mining
Major issues in data mining
Slideshare
 
Ruby On Rails Overview
Ruby On Rails OverviewRuby On Rails Overview
Ruby On Rails Overview
jonkinney
 
Segmentation Targeting Positioning
Segmentation Targeting PositioningSegmentation Targeting Positioning
Segmentation Targeting Positioning
Manish Parihar
 
Data mining (lecture 1 & 2) conecpts and techniques
Data mining (lecture 1 & 2) conecpts and techniquesData mining (lecture 1 & 2) conecpts and techniques
Data mining (lecture 1 & 2) conecpts and techniques
Saif Ullah
 
Market Segmentation, Targeting and Positioning
Market Segmentation, Targeting and PositioningMarket Segmentation, Targeting and Positioning
Market Segmentation, Targeting and Positioning
Daniel Gibson
 
Social Media Marketing for Restaurants: 21 tips
Social Media Marketing for Restaurants: 21 tipsSocial Media Marketing for Restaurants: 21 tips
Social Media Marketing for Restaurants: 21 tips
Wishpond
 
Java Tools and Technologies Landscape for 2014 (image gallery)
Java Tools and Technologies Landscape for 2014 (image gallery)Java Tools and Technologies Landscape for 2014 (image gallery)
Java Tools and Technologies Landscape for 2014 (image gallery)
ZeroTurnaround
 
mobile technologies iOS
mobile technologies iOSmobile technologies iOS
mobile technologies iOS
chrisiegers
 
1 seminario business plan che cos'è e a cosa serve
1  seminario business plan  che cos'è e a cosa serve1  seminario business plan  che cos'è e a cosa serve
1 seminario business plan che cos'è e a cosa serve
Intraprendereamodena
 
CPP's Advanced Dispersion Modeling Services
CPP's Advanced Dispersion Modeling ServicesCPP's Advanced Dispersion Modeling Services
CPP's Advanced Dispersion Modeling Services
Sergio A. Guerra
 
Technologies of today
Technologies of todayTechnologies of today
Technologies of today
kagecat
 
Python web frameworks
Python web frameworksPython web frameworks
Python web frameworks
NEWLUG
 
Advanced Technologies in Architecture
Advanced Technologies in ArchitectureAdvanced Technologies in Architecture
Advanced Technologies in Architecture
Isidro Navarro
 
1.3 applications, issues
1.3 applications, issues1.3 applications, issues
1.3 applications, issues
Krish_ver2
 
Advanced Python, Part 1
Advanced Python, Part 1Advanced Python, Part 1
Advanced Python, Part 1
Zaar Hai
 
C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)
Michael Redlich
 
Advanced Python Techniques: Decorators
Advanced Python Techniques: DecoratorsAdvanced Python Techniques: Decorators
Advanced Python Techniques: Decorators
Tomo Popovic
 
Server-side Technologies in Java
Server-side Technologies in JavaServer-side Technologies in Java
Server-side Technologies in Java
Anirban Majumdar
 
Python and BIG Data analytics | Python Fundamentals | Python Architecture
Python and BIG Data analytics | Python Fundamentals | Python ArchitecturePython and BIG Data analytics | Python Fundamentals | Python Architecture
Python and BIG Data analytics | Python Fundamentals | Python Architecture
Skillspeed
 
Major issues in data mining
Major issues in data miningMajor issues in data mining
Major issues in data mining
Slideshare
 
Ruby On Rails Overview
Ruby On Rails OverviewRuby On Rails Overview
Ruby On Rails Overview
jonkinney
 
Segmentation Targeting Positioning
Segmentation Targeting PositioningSegmentation Targeting Positioning
Segmentation Targeting Positioning
Manish Parihar
 
Data mining (lecture 1 & 2) conecpts and techniques
Data mining (lecture 1 & 2) conecpts and techniquesData mining (lecture 1 & 2) conecpts and techniques
Data mining (lecture 1 & 2) conecpts and techniques
Saif Ullah
 
Market Segmentation, Targeting and Positioning
Market Segmentation, Targeting and PositioningMarket Segmentation, Targeting and Positioning
Market Segmentation, Targeting and Positioning
Daniel Gibson
 
Social Media Marketing for Restaurants: 21 tips
Social Media Marketing for Restaurants: 21 tipsSocial Media Marketing for Restaurants: 21 tips
Social Media Marketing for Restaurants: 21 tips
Wishpond
 
Java Tools and Technologies Landscape for 2014 (image gallery)
Java Tools and Technologies Landscape for 2014 (image gallery)Java Tools and Technologies Landscape for 2014 (image gallery)
Java Tools and Technologies Landscape for 2014 (image gallery)
ZeroTurnaround
 
Ad

Similar to Python001 training course_mumbai (20)

Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
amiable_indian
 
Python ppt
Python pptPython ppt
Python ppt
Mohita Pandey
 
Python
PythonPython
Python
Praveen Konduru
 
Python
PythonPython
Python
prasad1ncc
 
Python
PythonPython
Python
JAVAID AHMAD WANI
 
Python_book.pdf
Python_book.pdfPython_book.pdf
Python_book.pdf
Dharmendra Jain
 
Python for Engineers and Architects Stud
Python for Engineers and Architects StudPython for Engineers and Architects Stud
Python for Engineers and Architects Stud
RaviRamachandraR
 
python introduction to user friendly.ppt
python introduction to user friendly.pptpython introduction to user friendly.ppt
python introduction to user friendly.ppt
Vinod Deenathayalan
 
python Basics of Python And Its features
python Basics of  Python And  Its featurespython Basics of  Python And  Its features
python Basics of Python And Its features
likhithareddymedapal
 
uso del lenguaje de programación python en métodos numéricos..ppt
uso del lenguaje de programación python en métodos numéricos..pptuso del lenguaje de programación python en métodos numéricos..ppt
uso del lenguaje de programación python en métodos numéricos..ppt
angelca13
 
uso del lenguaje de programación python en métodos numéricos..ppt
uso del lenguaje de programación python en métodos numéricos..pptuso del lenguaje de programación python en métodos numéricos..ppt
uso del lenguaje de programación python en métodos numéricos..ppt
angelca13
 
into python.pptinto python.pptinto python.ppt
into python.pptinto python.pptinto python.pptinto python.pptinto python.pptinto python.ppt
into python.pptinto python.pptinto python.ppt
yatakonakiran2
 
Learn Python in three hours - Python is an experiment
Learn Python in three hours - Python is an experimentLearn Python in three hours - Python is an experiment
Learn Python in three hours - Python is an experiment
Anil Yadav
 
python1.pptpppppppppppppppppppppppppppppppp
python1.pptpppppppppppppppppppppppppppppppppython1.pptpppppppppppppppppppppppppppppppp
python1.pptpppppppppppppppppppppppppppppppp
divijareddy0502
 
Python doc and Learn Python in three hours
Python doc and Learn Python in three hoursPython doc and Learn Python in three hours
Python doc and Learn Python in three hours
Anil Yadav
 
python_presentation_for students_high_school
python_presentation_for students_high_schoolpython_presentation_for students_high_school
python_presentation_for students_high_school
RakeshKumar483087
 
python programing 101 presentation ... Let's start
python programing 101 presentation ... Let's startpython programing 101 presentation ... Let's start
python programing 101 presentation ... Let's start
Mohsen Hefni
 
pythegggggeeeeeeeeeeeeeeeeeeeeeeeon1.ppt
pythegggggeeeeeeeeeeeeeeeeeeeeeeeon1.pptpythegggggeeeeeeeeeeeeeeeeeeeeeeeon1.ppt
pythegggggeeeeeeeeeeeeeeeeeeeeeeeon1.ppt
HamidKhemili
 
Sessisgytcfgggggggggggggggggggggggggggggggg
SessisgytcfggggggggggggggggggggggggggggggggSessisgytcfgggggggggggggggggggggggggggggggg
Sessisgytcfgggggggggggggggggggggggggggggggg
pawankamal3
 
Lecture-2-Python-Basic-Elements-Sep04-2018.pptx
Lecture-2-Python-Basic-Elements-Sep04-2018.pptxLecture-2-Python-Basic-Elements-Sep04-2018.pptx
Lecture-2-Python-Basic-Elements-Sep04-2018.pptx
AbdulQadeerBilal
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
amiable_indian
 
Python for Engineers and Architects Stud
Python for Engineers and Architects StudPython for Engineers and Architects Stud
Python for Engineers and Architects Stud
RaviRamachandraR
 
python introduction to user friendly.ppt
python introduction to user friendly.pptpython introduction to user friendly.ppt
python introduction to user friendly.ppt
Vinod Deenathayalan
 
python Basics of Python And Its features
python Basics of  Python And  Its featurespython Basics of  Python And  Its features
python Basics of Python And Its features
likhithareddymedapal
 
uso del lenguaje de programación python en métodos numéricos..ppt
uso del lenguaje de programación python en métodos numéricos..pptuso del lenguaje de programación python en métodos numéricos..ppt
uso del lenguaje de programación python en métodos numéricos..ppt
angelca13
 
uso del lenguaje de programación python en métodos numéricos..ppt
uso del lenguaje de programación python en métodos numéricos..pptuso del lenguaje de programación python en métodos numéricos..ppt
uso del lenguaje de programación python en métodos numéricos..ppt
angelca13
 
into python.pptinto python.pptinto python.ppt
into python.pptinto python.pptinto python.pptinto python.pptinto python.pptinto python.ppt
into python.pptinto python.pptinto python.ppt
yatakonakiran2
 
Learn Python in three hours - Python is an experiment
Learn Python in three hours - Python is an experimentLearn Python in three hours - Python is an experiment
Learn Python in three hours - Python is an experiment
Anil Yadav
 
python1.pptpppppppppppppppppppppppppppppppp
python1.pptpppppppppppppppppppppppppppppppppython1.pptpppppppppppppppppppppppppppppppp
python1.pptpppppppppppppppppppppppppppppppp
divijareddy0502
 
Python doc and Learn Python in three hours
Python doc and Learn Python in three hoursPython doc and Learn Python in three hours
Python doc and Learn Python in three hours
Anil Yadav
 
python_presentation_for students_high_school
python_presentation_for students_high_schoolpython_presentation_for students_high_school
python_presentation_for students_high_school
RakeshKumar483087
 
python programing 101 presentation ... Let's start
python programing 101 presentation ... Let's startpython programing 101 presentation ... Let's start
python programing 101 presentation ... Let's start
Mohsen Hefni
 
pythegggggeeeeeeeeeeeeeeeeeeeeeeeon1.ppt
pythegggggeeeeeeeeeeeeeeeeeeeeeeeon1.pptpythegggggeeeeeeeeeeeeeeeeeeeeeeeon1.ppt
pythegggggeeeeeeeeeeeeeeeeeeeeeeeon1.ppt
HamidKhemili
 
Sessisgytcfgggggggggggggggggggggggggggggggg
SessisgytcfggggggggggggggggggggggggggggggggSessisgytcfgggggggggggggggggggggggggggggggg
Sessisgytcfgggggggggggggggggggggggggggggggg
pawankamal3
 
Lecture-2-Python-Basic-Elements-Sep04-2018.pptx
Lecture-2-Python-Basic-Elements-Sep04-2018.pptxLecture-2-Python-Basic-Elements-Sep04-2018.pptx
Lecture-2-Python-Basic-Elements-Sep04-2018.pptx
AbdulQadeerBilal
 
Ad

Recently uploaded (20)

Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 

Python001 training course_mumbai

  • 1. Introduction to Python Vibrant Technologies & computer “Training Course in Mumbai” "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 2. Contents • Review: Introduction, Installing & Running. • Sample Code from Homework 0. • Names & Assignment • Containers: Lists, Tuples, Dictionaries • Mutability "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 3. What is Python? • A programming language with strong similarities to PERL, but with powerful typing and object oriented features. – Commonly used for producing HTML content on websites. Great for text files. – Useful built-in types (lists, dictionaries). – Clean syntax, powerful extensions. "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 4. Why Python for CSE-391? • Textbook Code: Very Object Oriented – Python much less verbose than Java • AI Processing: Symbolic – Python’s built-in datatypes for strings, lists, and more. – Java or C++ require the use of special classes for this. • AI Processing: Statistical – Python has strong numeric processing capabilities: matrix operations, etc. – Suitable for probability and machine learning code. "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 5. Technical Issues Installing & Running Python "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 6. Installing Python • Python is on eniac: /pkg/bin/python • Python for Win/Mac from www.python.org. • GUI development environment: IDLE. Credits: http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 7. IDLE Development Environment • Shell for interactive evaluation. • Text editor with color-coding and smart indenting for creating python files. • Menu commands for changing system settings and running files. • You’ll see me using IDLE in class. "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 8. Running Interactively on UNIX On Unix… % python >>> 3+3 6 The ‘>>>’ is the Python prompt. In Unix, when finished, you can use CONTROL+D. "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 9. Running Programs on UNIX % python filename.py You can create python files using emacs. (There’s a special Python editing mode.) You could even make the *.py file executable and add the following text to top of the file to make it runable: #!/pkg/bin/python "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 10. Understanding the Basics "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 11. Look at a sample of code… x = 34 - 23 # A comment. y = “Hello” # Another one. z = 3.45 if z == 3.45 or y == “Hello”: x = x + 1 y = y + “ World” # String concat. print x print y "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 12. Look at a sample of code… x = 34 - 23 # A comment. y = “Hello” # Another one. z = 3.45 if z == 3.45 or y == “Hello”: x = x + 1 y = y + “ World” # String concat. print x print y "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 13. Enough to Understand the Code • Assignment uses = and comparison uses ==. • For numbers +-*/% are as expected. – Special use of + for string concatenation. – Special use of % for string formatting. • Logical operators are words (and, or, not) not symbols (&&, ||, !). • The basic printing command is “print.” • First assignment to a variable will create it. – Variable types don’t need to be declared. – Python figures out the variable types on its own. "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 14. Basic Datatypes • Integers (default for numbers) z = 5 / 2 # Answer is 2, integer division. • Floats x = 3.456 • Strings Can use “” or ‘’ to specify. “abc” ‘abc’ (Same thing.) Unmatched ones can occur within the string. “matt’s” Use triple double-quotes for multi-line strings or strings than contain both ‘ and “ inside of them: “““a‘b“c””” "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 15. Whitespace • Whitespace is meaningful in Python: especially indentation and placement of newlines. – Use a newline to end a line of code. (Not a semicolon like in C++ or Java.) (Use when must go to next line prematurely.) – No braces { } to mark blocks of code in Python… Use consistent indentation instead. The first line with a new indentation is considered outside of the block. – Often a colon appears at the start of a new block. (We’ll see this later for function and class definitions.) "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 16. Comments • Start comments with # – the rest of line is ignored. • Can include a “documentation string” as the first line of any new function or class that you define. • The development environment, debugger, and other tools use it: it’s good style to include one. def my_function(x, y): “““This is the docstring. This function does blah blah blah.””” # The code would go here... "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 17. Look at a sample of code… x = 34 - 23 # A comment. y = “Hello” # Another one. z = 3.45 if z == 3.45 or y == “Hello”: x = x + 1 y = y + “ World” # String concat. print x print y "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 18. Understanding Assignment "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 19. Names and References 1 • Python has no pointers like C or C++. Instead, it has “names” and “references”. (Works a lot like Lisp or Java.) • You create a name the first time it appears on the left side of an assignment expression: x = 3 • Names store “references” which are like pointers to locations in memory that store a constant or some object. – Python determines the type of the reference automatically based on what data is assigned to it. – It also decides when to delete it via garbage collection after any names for the reference have passed out of scope. "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 20. Names and References 2 • There is a lot going on when we type: x = 3 • First, an integer 3 is created and stored in memory. • A name x is created. • An reference to the memory location storing the 3 is then assigned to the name x. Type: Integer Data: 3 Name: x Ref: <address1> name list memory "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 21. Names and References 3 • The data 3 we created is of type integer. In Python, the basic datatypes integer, float, and string are “immutable.” • This doesn’t mean we can’t change the value of x… For example, we could increment x. >>> x = 3 >>> x = x + 1 >>> print x 4 "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 22. Names and References 4 • If we increment x, then what’s really happening is: – The reference of name x is looked up. – The value at that reference is retrieved. – The 3+1 calculation occurs, producing a new data element 4 which is assigned to a fresh memory location with a new reference. – The name x is changed to point to this new reference. – The old data 3 is garbage collected if no name still refers to it. Type: Integer Data: 3Name: x Ref: <address1> "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 23. Names and References 4 • If we increment x, then what’s really happening is: – The reference of name x is looked up. – The value at that reference is retrieved. – The 3+1 calculation occurs, producing a new data element 4 which is assigned to a fresh memory location with a new reference. – The name x is changed to point to this new reference. – The old data 3 is garbage collected if no name still refers to it. Type: Integer Data: 3Name: x Ref: <address1> Type: Integer Data: 4 "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 24. Names and References 4 • If we increment x, then what’s really happening is: – The reference of name x is looked up. – The value at that reference is retrieved. – The 3+1 calculation occurs, producing a new data element 4 which is assigned to a fresh memory location with a new reference. – The name x is changed to point to this new reference. – The old data 3 is garbage collected if no name still refers to it. Type: Integer Data: 3Name: x Ref: <address2> Type: Integer Data: 4 "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 25. Names and References 4 • If we increment x, then what’s really happening is: – The reference of name x is looked up. – The value at that reference is retrieved. – The 3+1 calculation occurs, producing a new data element 4 which is assigned to a fresh memory location with a new reference. – The name x is changed to point to this new reference. – The old data 3 is garbage collected if no name still refers to it. Name: x Ref: <address2> Type: Integer Data: 4 "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 26. Assignment 1 • So, for simple built-in datatypes (integers, floats, strings), assignment behaves as you would expect: >>> x = 3 # Creates 3, name x refers to 3 >>> y = x # Creates name y, refers to 3. >>> y = 4 # Creates ref for 4. Changes y. >>> print x # No effect on x, still ref 3. 3 "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 27. Assignment 1 • So, for simple built-in datatypes (integers, floats, strings), assignment behaves as you would expect: >>> x = 3 # Creates 3, name x refers to 3 >>> y = x # Creates name y, refers to 3. >>> y = 4 # Creates ref for 4. Changes y. >>> print x # No effect on x, still ref 3. 3 Type: Integer Data: 3 Name: x Ref: <address1> "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 28. Assignment 1 • So, for simple built-in datatypes (integers, floats, strings), assignment behaves as you would expect: >>> x = 3 # Creates 3, name x refers to 3 >>> y = x # Creates name y, refers to 3. >>> y = 4 # Creates ref for 4. Changes y. >>> print x # No effect on x, still ref 3. 3 Type: Integer Data: 3 Name: x Ref: <address1> Name: y Ref: <address1> "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 29. Assignment 1 • So, for simple built-in datatypes (integers, floats, strings), assignment behaves as you would expect: >>> x = 3 # Creates 3, name x refers to 3 >>> y = x # Creates name y, refers to 3. >>> y = 4 # Creates ref for 4. Changes y. >>> print x # No effect on x, still ref 3. 3 Type: Integer Data: 3 Name: x Ref: <address1> Type: Integer Data: 4 Name: y Ref: <address1> "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 30. Assignment 1 • So, for simple built-in datatypes (integers, floats, strings), assignment behaves as you would expect: >>> x = 3 # Creates 3, name x refers to 3 >>> y = x # Creates name y, refers to 3. >>> y = 4 # Creates ref for 4. Changes y. >>> print x # No effect on x, still ref 3. 3 Type: Integer Data: 3 Name: x Ref: <address1> Type: Integer Data: 4 Name: y Ref: <address2> "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 31. Assignment 1 • So, for simple built-in datatypes (integers, floats, strings), assignment behaves as you would expect: >>> x = 3 # Creates 3, name x refers to 3 >>> y = x # Creates name y, refers to 3. >>> y = 4 # Creates ref for 4. Changes y. >>> print x # No effect on x, still ref 3. 3 Type: Integer Data: 3 Name: x Ref: <address1> Type: Integer Data: 4 Name: y Ref: <address2> "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 32. Assignment 2 • For other data types (lists, dictionaries, user-defined types), assignment works differently. – These datatypes are “mutable.” – When we change these data, we do it in place. – We don’t copy them into a new memory address each time. – If we type y=x and then modify y, both x and y are changed! – We’ll talk more about “mutability” later. >>> x = 3 x = some mutable object >>> y = x y = x >>> y = 4 make a change to y >>> print x look at x 3 x will be changed as well immutable mutable "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 33. Container Types in Python "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 34. Container Types • We’ve talked about integers, floats, and strings… • Containers are other built-in data types in Python. – Can hold objects of any type (including their own type). – There are three kinds of containers: Tuples • A simple immutable ordered sequence of items. Lists • Sequence with more powerful manipulations possible. Dictionaries • A look-up table of key-value pairs."Vibrant Technology & Computer" Vashi, Navi mumbai
  • 35. Tuples, Lists, and Strings: Similarities "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 36. Similar Syntax • Tuples and lists are sequential containers that share much of the same syntax and functionality. – For conciseness, they will be introduced together. – The operations shown in this section can be applied to both tuples and lists, but most examples will just show the operation performed on one or the other. • While strings aren’t exactly a container data type, they also happen to share a lot of their syntax with lists and tuples; so, the operations you see in this section can apply to them as well. "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 37. Tuples, Lists, and Strings 1 • Tuples are defined using parentheses (and commas). >>> tu = (23, ‘abc’, 4.56, (2,3), ‘def’) • Lists are defined using square brackets (and commas). >>> li = [“abc”, 34, 4.34, 23] • Strings are defined using quotes (“, ‘, or “““). >>> st = “Hello World” >>> st = ‘Hello World’ >>> st = “““This is a multi-line string that uses triple quotes.””” "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 38. Tuples, Lists, and Strings 2 • We can access individual members of a tuple, list, or string using square bracket “array” notation. >>> tu[1] # Second item in the tuple. ‘abc’ >>> li[1] # Second item in the list. 34 >>> st[1] # Second character in string. ‘e’ "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 39. Looking up an Item >>> t = (23, ‘abc’, 4.56, (2,3), ‘def’) Positive index: count from the left, starting with 0. >>> t[1] ‘abc’ Negative lookup: count from right, starting with –1. >>> t[-3] 4.56 "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 40. Slicing: Return Copy of a Subset 1 >>> t = (23, ‘abc’, 4.56, (2,3), ‘def’) Return a copy of the container with a subset of the original members. Start copying at the first index, and stop copying before the second index. >>> t[1:4] (‘abc’, 4.56, (2,3)) You can also use negative indices when slicing. >>> t[1:-1] (‘abc’, 4.56, (2,3))"Vibrant Technology & Computer" Vashi, Navi mumbai
  • 41. Slicing: Return Copy of a Subset 2 >>> t = (23, ‘abc’, 4.56, (2,3), ‘def’) Omit the first index to make a copy starting from the beginning of the container. >>> t[:2] (23, ‘abc’) Omit the second index to make a copy starting at the first index and going to the end of the container. >>> t[2:] (4.56, (2,3), ‘def’)"Vibrant Technology & Computer" Vashi, Navi mumbai
  • 42. Copying the Whole Container You can make a copy of the whole tuple using [:]. >>> t[:] (23, ‘abc’, 4.56, (2,3), ‘def’) So, there’s a difference between these two lines: >>> list2 = list1 # 2 names refer to 1 ref # Changing one affects both >>> list2 = list1[:] # Two copies, two refs # They’re independent "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 43. The ‘in’ Operator • Boolean test whether a value is inside a container: >>> t = [1, 2, 4, 5] >>> 3 in t False >>> 4 in t True >>> 4 not in t False • Be careful: the ‘in’ keyword is also used in the syntax of other unrelated Python constructions: “for loops” and “list comprehensions.”"Vibrant Technology & Computer" Vashi, Navi mumbai
  • 44. The + Operator • The + operator produces a new tuple, list, or string whose value is the concatenation of its arguments. >>> (1, 2, 3) + (4, 5, 6) (1, 2, 3, 4, 5, 6) >>> [1, 2, 3] + [4, 5, 6] [1, 2, 3, 4, 5, 6] >>> “Hello” + “ ” + “World” ‘Hello World’"Vibrant Technology & Computer" Vashi, Navi mumbai
  • 45. The * Operator • The * operator produces a new tuple, list, or string that “repeats” the original content. >>> (1, 2, 3) * 3 (1, 2, 3, 1, 2, 3, 1, 2, 3) >>> [1, 2, 3] * 3 [1, 2, 3, 1, 2, 3, 1, 2, 3] >>> “Hello” * 3 ‘HelloHelloHello’ "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 46. Mutability: Tuples vs. Lists What’s the difference between tuples and lists? "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 47. Tuples: Immutable >>> t = (23, ‘abc’, 4.56, (2,3), ‘def’) >>> t[2] = 3.14 Traceback (most recent call last): File "<pyshell#75>", line 1, in -toplevel- tu[2] = 3.14 TypeError: object doesn't support item assignment You’re not allowed to change a tuple in place in memory; so, you can’t just change one element of it. But it’s always OK to make a fresh tuple and assign its reference to a previously used name. >>> t = (1, 2, 3, 4, 5) "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 48. Lists: Mutable >>> li = [‘abc’, 23, 4.34, 23] >>> li[1] = 45 >>> li [‘abc’, 45, 4.34, 23] We can change lists in place. So, it’s ok to change just one element of a list. Name li still points to the same memory reference when we’re done. "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 49. Operations on Lists Only 1 • Since lists are mutable (they can be changed in place in memory), there are many more operations we can perform on lists than on tuples. • The mutability of lists also makes managing them in memory more complicated… So, they aren’t as fast as tuples. It’s a tradeoff. "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 50. Operations on Lists Only 2 >>> li = [1, 2, 3, 4, 5] >>> li.append(‘a’) >>> li [1, 2, 3, 4, 5, ‘a’] >>> li.insert(2, ‘i’) >>>li [1, 2, ‘i’, 3, 4, 5, ‘a’] "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 51. Operations on Lists Only 3 The ‘extend’ operation is similar to concatenation with the + operator. But while the + creates a fresh list (with a new memory reference) containing copies of the members from the two inputs, the extend operates on list li in place. >>> li.extend([9, 8, 7]) >>>li [1, 2, ‘i’, 3, 4, 5, ‘a’, 9, 8, 7] Extend takes a list as an argument. Append takes a singleton. >>> li.append([9, 8, 7]) >>> li [1, 2, ‘i’, 3, 4, 5, ‘a’, 9, 8, 7, [9, 8, 7]] "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 52. Operations on Lists Only 4 >>> li = [‘a’, ‘b’, ‘c’, ‘b’] >>> li.index(‘b’) # index of first occurrence 1 >>> li.count(‘b’) # number of occurrences 2 >>> li.remove(‘b’) # remove first occurrence >>> li [‘a’, ‘c’, ‘b’] "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 53. Operations on Lists Only 5 >>> li = [5, 2, 6, 8] >>> li.reverse() # reverse the list *in place* >>> li [8, 6, 2, 5] >>> li.sort() # sort the list *in place* >>> li [2, 5, 6, 8] >>> li.sort(some_function) # sort in place using user-defined comparison "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 54. Tuples vs. Lists • Lists slower but more powerful than tuples. – Lists can be modified, and they have lots of handy operations we can perform on them. – Tuples are immutable and have fewer features. • We can always convert between tuples and lists using the list() and tuple() functions. li = list(tu) tu = tuple(li) "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 55. More About Assignment Classes, Functions, Naming Rules "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 56. Assignment & Mutability 1 • Remember that assignment works differently for mutable vs. immutable datatypes. – If you type y=x, then changing y: …will change x if they are mutable. …won’t change x if they are immutable. >>> x = 3 >>> x = [ 1, 2, 3] >>> y = x >>> y = x >>> y = y + 1 >>> y.reverse() >>> print x >>> print x 3 [ 3, 2, 1] immutable mutable "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 57. Assignment & Mutability 2 Python is object-oriented, and user-defined classes are mutable. Let’s say that the name x refers to an object of some class. This class has a “set” and a “get” function for some value. >>> x.getSomeValue() 4 What happens if we create a new name y and set y=x ? >>> y = x This creates a new name y which points to the same memory reference as the name x. Now, if we make some change to y, then x will be affected as well. >>> y.setSomeValue(3) >>> y.getSomeValue() 3 >>> x.getSomeValue() 3 "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 58. Assignment & Mutability 3 • When passing parameters to functions: – Immutable data types are “call by value.” – Mutable data types are “call by reference.” – If you pass mutable data to a function, and you change it inside that function, the changes will persist after the function returns. – Immutable data appear unchanged inside of functions to which they are passed. "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 59. Naming Rules • Names are case sensitive and cannot start with a number. They can contain letters, numbers, and underscores. bob Bob _bob _2_bob_ bob_2 BoB • There are some reserved words: and, assert, break, class, continue, def, del, elif, else, except, exec, finally, for, from, global, if, import, in, is, lambda, not, or, pass, print, raise, return, try, while "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 60. Accessing Non-Existent Name • If you try to access a name before it’s been properly created (by placing it on the left side of an assignment), you’ll get an error. >>> y Traceback (most recent call last): File "<pyshell#16>", line 1, in -toplevel- y NameError: name ‘y' is not defined >>> y = 3 >>> y 3 "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 61. Multiple Assignment • You can also assign to multiple names at the same time. >>> x, y = 2, 3 >>> x 2 >>> y 3 "Vibrant Technology & Computer" Vashi, Navi mumbai
  • 62. Thank you Vibrant Technologies & computers Vashi,Navi Mumbai "Vibrant Technology & Computer" Vashi, Navi mumbai