Professional Documents
Culture Documents
Log book
Log book
TOPIC:
INTRODUCTION TO AI,ML,DL
OBSERVATIONS:
ARTIFICIAL INTELLIGENCE-
MACHINE LEARNING-
DEEP LEARNING-
TOPIC:
Supervised ML
Data format-
Supervised ML works on labelled data(where input and output(prediction) are available.
This ML model understands the relation between input and output data.
EX- weather prediction, loan prediction
Unsupervised ML-
Input data is available but output is not available.
Segmentation of data.
Reinforcement ML-
Based on decision making in real time.
Input data(Labelled data) available.
Works based on reward system.
Right decision- reward to agent
Wrong decision- penalty to agent
EX- self driving car
DAY-3:19/02/2024
TOPIC:
PROGRAMMING LANGUAGE-
OBSERVATIONS:
PROGRAM-
A set of instructions to follow/ A set of information given.
Types of programming languages-
TOPIC:
OBSERVATION:
In terminal we can open any application and see the execution of the code in the terminal.
TOPIC:
WHAT IS PYTHON?
OBSERVATION:
PYTHON:
Programming language
Using
INTERPRETED- Dependent on interpreter for code execution(running code)
HIGH LEVEL- Contains Compiler or interpreter
MULTI-PURPOSE- 1-web Development
2-App Development
3-Server Management
4-Data science
5-Data engineering
6-IOT
Version 3 is used For Data science.
DAY-6:
TOPIC:
PROPERTIES OF PYTHON
OBSERVATIONS:
We don’t require to specify the data type before writing the code & we can reassign another data
type to the variable.
INDENTATION-
There should be no space at the beginning of the code. The compiler generates error.
USE OF INDENTATION-
PUNTUATION-
Don’t use punctuations at the end of the code. The compiler generates error.
Print(x=10).
DAY-7:
TOPIC:
OBSERVATIONS:
VARIABLES:
-Stores data/value
X=10
IDENTIFIERS
-user defined name
RULES OF VARIABLES/IDENTIFIERS
-should only contain alphabets, numbers, underscore
-should not be of a keyword(keywords are the characters that have a special meaning in PYTHON)
-if we want to distinguish/ separate use underscore or camelCase (VijayPandu, using capital letter at
the beginning of separation).
TOPIC:
ARITHMTICS OPERATORS
LOGICAL OPERATORS
BITWISE OPERATORS-
IDENTITY OPERATORS
ASSIGNMENT OPPERATORS-
MEMBERSHIP OPERATOR
OBSERVATIONS:
ARITHMTICS OPERATORS
(+ , - , * , / , // , % , **)
LOGICAL OPERATORS
(and , or , not)
BITWISE OPERATORS-
BITWISE ‘&’ OPERATOR-
COMPLEMENT OPERATOR(~)-
IDENTITY OPERATORS
(is , ==)
ASSIGNMENT OPPERATORS-
‘=’ – Variable Assignment-
‘+=’- INCREMENT-
‘-=’- DECREMENT-
‘*=’- MULTIPLICATION-
‘/=’- DIVISION-
‘**=’- EXPONENT-
‘<<=’-LEFT SHIFT
‘>>=’-RIGHT SHIFT
MEMBERSHIP OPERATOR
in and not in
DAY-9:
Topic:
String
Observation:
A sequence of characters
These strings are internally stored as a combination of 0’s & 1’s.a -65, b- 66,c- 67,etc
These conversion is encoding and reverse is decoding
Encoding methods=ASCII and UNICODE.
Python doesn’t have character data type like other programming language.
The ascii code of a=65 ,b=66,……and soon
DAY-10:
Some bulit in functions of string
Observations:
UPPER()-
This function helps in making all the characters in string to Uppercase letters.
LOWER()-
This function helps in making all the characters in string to lowercase letters.
TITLE-
COUNT-
FIND-
Helps to find the staring index position of the sub string in main string
DAY-11:
Topic :
Lists
Observations:
LISTS
List is a collection of data in python which are defined using [ ] and collect the various
elements inside it.
We can store multiple values in a single variable.
Each element in the [ ] is separated by ‘ , ‘
DUPLICATED VALUES- Lists allows duplicate values
ORDERED- lists are always main order in element (sorting)
INDEXING- Indexing can be used to access the elements in the lists.
OBJECTS- lists can contain any objects including numbers, strings, tuples & even other lists.
CHANGEABLE(MUTABLE)- Can be changed (add or del or change the place the place or
update)
EXAMPLE: [1,2,3,4,5]
DAY-12:
Some bulit in methods of lists
Observation:
APPEND:
EXTEND:
POP():
COPY:
DEEP COPY:
Used to copy the list in a new memory location.Even the nested lists are also copied in a new
memory location. To use deepcopy uh need to import copy module in python.
CLEAR:
Observations:
PACKING:
a=10
b=12
t1=(a,b)
print(t1,type(t1))
UNPACKING:
t1=(1,2,3)
p,q,r=t1
print(p)
print(q)
print(r)
output= 1 2 3
NOTE: during unpacking we should take all number of variables(the variables are 2 or 4 but the
element in tuple is 3 ) to get the desired output orelse the result will be error
DAY-15:
SETS{}:
Observations:
Sets are like lists which is used to store the collection of data/elements
We declare sets using { }
NO DUPLICATES: It doesn’t allow duplicate values.
UNORDERED: It do not maintain the assigned order.
UNINDEXED: It do not allow indexing
MUTABLE/IMMUTABLE: sets are mutable with a condition.we can add/remove elements in
the sets but we can not change the elements in the sets because indexing is not supported.
DAY-16:
Observations:
UPDATE():
REMOVE:
Using remove() we can remove an element in a set. If the element is not presented in a set then it
shows error.
DISCARD:
Using discard() we can remove an element in a set but unlike remove it doesn’t show error if the
element is not presented in a set.
SORT:
It is used to sort the elements in the set and it returns the output as a list.
POP()
DICTIONARY:
Observations:
Dictionary are the collection of data which contains key-value pairs.
Dictionaries are ordered, indexable and mutable.
Don’t allow duplicates
Defined using { }
Day-18:
OBSERVATION:
GET():
Used to access the value using the variable name and key in the dictionary, if the key is not present in
the dictionary then the output will be none.
POPITEM():
DEL():
CONDITIONAL STATEMENT:
OBSERVATIONS:
Conditional statements are used to control flow of the program. They execute the blocks of code
based on the truthfulness of the conditional statement.
PYTHON INDENTATION:
In python, the code blocks are defined by a set of common or consistent number of spaces. Those
spaces are called PYTHON INDENTATION
IF STATEMENT:
The if keyword is used to check the statement and execute the subsequent block of code based on
the truthfulness of the statement.
IF-ELSE:
NESTED IF ELSE-
If we have more conditions to test ,we can use nested if-else to print the output.
ELIF STATEMENTS:
OBSERVATION.
In elif only one true block will generate output , but where in nested if-else all the block which are
true will generate output.
If condition1:
If condition2:
Print(‘nested if block’)
Else:
Else:
Print(‘else block’)
ELIF:
If condition:
Print(‘if block’)
Elif condition:
Print(‘elif block’)
Else:
Print(‘else block’)
DAY-21:
CONTROLFLOW STATEMENT:
OBSERVATIONS:
PASS:
If we don’t have any code block in if statement or we don’t want to have any code block then we can
use pass keyword to skip the code block and avoid indentation error.
BREAK:
CONTINUE STATEMENT:
It is used to skip an iteration but the program run till the last iteration..
LOOP:
OBSERVATION:
LOOP:
Loop gives the ability to run the code again and again.
FOR LOOP:
When we want to run the repeatedly for n time, then we use for loop to run the code again again for
n time.
WHILE LOOPS:
After every iteration status of the condition is checked if the condition is true then only the next
iteration begins.
DAY-23:
NESTED LOOPS
OBSERVATIONS:
OUTER LOOP:
Runs=1
INNER LOOP:
LIST COMPREHENSION:
OBSERVATIONS:
Use to populate lists/create lists using other collections and for loop.
It a short cut or simple way to write for loop for small programs.
The result should only be a value and element not the reassignment.
DAY-25:
FUNCTIONS:
OBSERVATIONS:
FUNCTIONS:
-functions make the code as a modular such that the code usage will be effective.
BULIT-IN FUNCTIONS:
These built in functions are the functions which comes along with the python.
Print(),len(),s1.lower(),l1.append()
OBSERVATION:
-as function names are also identifiers similar to variable names, they follow same naming rules
ELEMENTS IN FUNCTION
OBSERVATION:
2.FUNCTION PARAMETERS- the input that entered in the brackets of function, the same input we
have use in writing the mathematical expression or function block while defining the function.
4.FUNCTION BLOCK- the line following the indentation after the function definition.
5.FUNCTION RETURN- the variable/value returned by function to store them in another variable.
DAY-28:
POSITIONAL ARGUMENTS:
KEYWORD ARGUMENTS:
OBSERVATIONS:
POSITIONAL ARGUMENTS:
KEYWORD ARGUMENTS:
When we call the function, the function considers the order of arguments as order of parameters.
Assigning the values(arguments) to the parameters(the variables used while defining the function)
DAY-29:
PROPERTIES OF FUNCTION:
OBSERVATIONS:
PROPERTIES OF FUNCTION:
-if return statement is there then the particular value is been returned.
2. Return statement not only returns/stores the value it is also used to stop the execution of the
function.
3.when we return multiple variables, we should use necessary variables to or single variable to store
the values that function is returning. Using less or more variables to store the returned value of the
function shows value error.
4.using single variable to store the return value make the output stored in the form of a tuple.
5.when we try to check the type of the function name that we used to create a function it shows that
the type is function.
9.As functions treated as data objects we can use them in another data types like list,tuple,set,etc.
DAY-30:
OBSERVATION:
When we do direct call of filename.py file ->then __name__variable takes values as __main__
Code outside of main runs but code inside of main didn’t run.
When we do module call of filename.py -> then __name__ variable takes value as module name/file
name.
If __name__=’__main__’:
Code
LAMBDA FUNCTION:
Nameless function.
ZIP FUNCTION:
MAP FUNCTION:
FILTER FUNCTION:
It applies a condition on elements of an iterable/collection and then filters the elements based on
condition. The elements in the iterable/ collection will remains same value.
REDUCE FUNCTION:
EXCEPTION HANDLING:
OBSERVATIONS:
EXCEPTION HANDLING:
1.Syntax error
TRY-EXCEPT BLOCK
OBSERVATION:
Python would try to execute TRY block but if any error occur in try block then except block would
start running.
By using try and except block the code will run end to end even though there is some error in the
code(Run time error).
If any error occur in try block then except block will start executing. The line after the exception will
stop getting executed.
DAY-34:
OBSERVATION:
FINALLY KEYWORD:
Finally is keyword. The block code in finally keyword is always runs irrespective of the error.
FILE HANDLING
OBSERVATION:
FILE HANDLING:
When we restart the application all the data/information/variable will be lost to overcome this we
use file handling.
These files are created to store the information because the information that is been written the
code is not permanent.so, we use files to store the data/information. Stopping the execution of code,
close the program, etc led to deletion of the data.
All files are stored in binary format in computer memory- ROM (Hard drives, SSD’s)
.txt , .jpg , .mp3 ,.mp4, .pdf in all these formats the data is been stored in binary format(combination
of 0 & 1’s)
1024bytes=1kb
DAY-36:
OPEN FUNCTION
WRITE FORMAT
APPEND FORMAT
EXIST MODE(x):
READ MODE:
CLOSE
OBSERVATION:
OPEN FUNCTION:
Create a file object in which we can put the data and save the file.
WRITE FORMAT
W is the mode of the file w means write format. We put W to write or edit the file.
When file is opened in write mode, it creates a new empty file at same location.
APPEND FORMAT
append format is used to add new lines to existing file without deleting previous file.
CLOSE:
Close keyword- closing the file – it’s needed such that once use of the file is done we can free its
memory from RAM.
EXIST MODE(x):
If a file already exists at the given location then exist mode will not create a new file at the same
location it shows FileExistsError.
READ MODE:
Read mode is used to read all the data in the file in a single statement
DAY-37:
OBSERVATION:
prices={'apple':100,'banana':40,'cherry':80,'watermelon':60}
kgs={}
p={}
total=0
for k in prices.keys():
file=open('bill.txt','w')
file.write('-------------------\n')
for k in prices.keys():
p[k]=prices[k]*kgs[k]
file.write(f'k|{prices[k]}|{kgs[k]}|{p[k]}')
total+=p[k]
file.write(f'Total Cost={total}')
file.close()
Day-38:
OBSERVATIONS:
CLASS:
OBJECTS:
OBSERVATION:
INTRODUCTION OF OOPs
Almost all the things we see in python are objects and classes.
BENEFITS:
Uniformity of program/data types /functionality(almost all the functions of an object works similar to
other object in same class.)
OB SERVATION:
We can create a class in python using the keyword class followed by class name.
Class attributes and methods of the class are defined inside the indentation of the class keyword.
For every class method definition, self keyword must be the 1st parameter.
Class methods are local for given class. We cant use class methods until we create we create an
object
When we access object attributes/methods outside of class definition, we use object names.
But inside class definition we use self as a place holder / reference to class instance.
DAY-41:
OBSERVATIONS:
CONSTRUCTOR
Static variables are common values in the class. These static variables gets assigned by values before
defining the constructor.
INSTANCE VARIABLES:
OBSERVATIONS:
FUNCTION OVERRIDING:
FUNCTION OVERLOADING:
TYPES OF METHODS
OBSERVATIONS:
TYPED OF METHODS:
-Instance methods
-Class methods
-Static methods.
INSTANCE METHODS:
CLASS METHOD:
STATIC METHOD:
Instance/class
PILLARS OF OPPs:
OBSERVATION:
1.INHERITANCE:
POLYMORPHISM:
Polymorphism—
ENCAPSULATION:
ABSTRACTION:
Hiding complex information(from end user/anyone) and only showing necessary information is the
base of abstraction.
Whenever we create a class and its methods, attributes then user is unknown of internal complexity
of class.
INHERITANCE
OBSERVATION:
1.Basic Inheritance
Child has all the properties of parent but doesn’t have any of its own properties.
Here child student is inheriting constructor and info method from parent Person.
2.Single Inheritance
We can override the functions, methods but we can still reuse them inside the child class.
So that the relation between the child and parent class is been maintained and the child will also
exhibit some new properties.Some modified behaviour of the methods.
Here, a child class(B) is been parent to another class(C) and the child’s child class(C) will have both
the parent class properties (A),child class properties (B)and its own properties(C).
4.Multiple Inheritance
5.Hybrid Inheritance
In hybrid inheritance, there are multiple parents for same child class / some parent classes will
become child classes.
DAY-46:
POLYMORPHISM
OBSERVATION:
BENEFITS OF POLYMORPHISM:
ENCAPSULATION
Observation:
PUBLIC VARIABLES/MEMBER:
Public variables are the variables/attributes that can be accessed outside of class.
PRIVATE VARIABLE/MEMBER:
PROTECTED MEMBERS:
But can be accessed inside parents class and its child class.
ABSTRACTION
OBSERVATION:
In order to maintain uniformity of applications like this- we create a Abstract Base Class.
This ABC is used as a blueprint for all the classes(for which we need uniform behaviour) inside an
application.
Observation:
NAME MANGLING:
Using Name mangling we can also access and modify the ‘Private’ attributes outside of the class.
Python programming language has ’freedom for developers’ as its basic pillar.
Developers should be able to make all type of changes in the code that they use.
Which all attributes/members should not be access outside of the class directly.
If we add more than one ’_’ in suffix, then name mangling rule changes for that attribute.
DAY-50:
OBSERVATION:
Class Error(Exception):
#Here Exception is passed as a parent class. Exception is the inbuilt class that python has.
Class Error(Exception):
Pass
Class NegativeValueError(Error):
Pass
Here basic Inheritance is been followed by both Error and Negative Value Error.