>>> x=2345
>>> print(type(x))
<class 'int'>
>>> y=3.14
>>> print(type(y))
<class 'float'>
>>> z=1.5e2
>>> type(type(z))
<class 'type'>
>>>
complex data type is used in linear programming (Machine learning programming-MLP)
MLP - image is captured and analyze, recognized it..
there are real and immaginary
c = (real part) + 2(Imaginary_number)
c=2_4j
d=6-2j
e=-4j
f=6+1j
value of j=square root of -1 (sq root of -1)
STR type
In python is object
int,str, eveyrhting is class
we use built-in functions
Advanced Python
----------------
Topics
- Collections
- Functions
- Modules & Packages - Organizing packages
- OOPS - Object oriented programming
- Exception handling (Error)
- Regular Expression in Python
- Working with files (txt,cvs)
- Working with Date and Time
- Multithreading
- Database connectivity
- GUI applications
- Python for datascience (Numpy, Pandas, .. )
Collections
list
tuple
set
frozenset
dict
----------------------
Ticket # is assigned to each ticket for passenger.
t1=2345
t2=2346
t3=4564
Ticket is assigned to individual variable.
This is not a good way to assign the value
we want to treat these data as a group.
so we store together in a collection
these data belongs to same group.
treat these ticket numbers as a group.
say as collection
ticket_numbers=[2345, 2346, 4564]
store data into collection so we can perform operation on group belongs to same group.
data stored in individual variable, in memory, its stored of different location
not stored on contious location which cause the performance proble,
say
t1=12
t2=23
t3=34
what happens in memory, they stored in different location
it start looking for on different location for each variable and performance will be slow
now say
ticket_number=[12, 23, 34]
what happens in memory?
in memory, these are stored as collection. contious memory location
We can do searching,
List belongs to
mutable or unmutable objects?
->mutable object
Is it sequence type?
- Yes
List is collection type and stores related group of data together.
say ticket numbers of passenger flying together.
we treat all these data as group.
lets say, university offering some courses to her students.
- all courses should be treated as group..
treat data as a group.
course1 = "Math"
course2 = "Science"
course3 = "English"
courses= = ["Math", "Scence", " English" ]
ticket_numbers = [ 12, 23, 34 ]
List
- list is mutable object.
you have to decide what type of collection you are going to use based on what that collection going to offer.
Choose collection type as list,
suppose your requirement is you have to modify the content of that object anytime or want to modify the content of the object. for eg, ticket numbers
passenger cancel ticket 23, i want to remove this entry from this group of data. This object should allow me to modify.
what object allow you to modify its content?
- mutable object
list, set - allow you to change
it should allow you to access the data and allow to modify
choose collection based on what operation you want to perform on data.
list is sequence type (mutable object)
allow you to modify based on index.
ticket_numbers = [ 12, 23, 24 ]
index_number 1 2 3
you want to remove second index [1]
No comments:
Post a Comment