Venkata Vinod
Venkata Vinod
BACHELOR OF TECHNOLOGY
in
Regd.No.:21781A0403
Under Supervision of
SARVESH MADHU AGRAWAL, Team lead
INTERNSHALA trainings
(14/08/2023 to 20/09/2023)
CERTIFICATE
This is to certify that the “Internship report” submitted by AKULA
VENKATA VINOD
(Regd.No.:21781A0403) is work done by him/her and submitted during
2023- 2024
BACHELOR OF TECHNOLOGY in ELECTRONICS AND
COMMUNICATION ENGINEERING academic year, in partial ful fillment of
the requirements for the award of the degree of ELECTRONICS AND
COMMUNICATION ENGINEERING,INTERNSHALA
Vice Chairman, Sri R.V.Srinivas for his valuable support throughout the
course.
20/09/2023 Wednesday
MACHINE LERANING WITH PYTHON
ABSTRACT
Contents
Chapter-1
.............................................................................................................................
..................
1
INTRODUCTION
................................................................................................................ .................
1
Scripting Language
................................................................................................................................
1
Object Oriented Programming Language
........................................................................................ ...... 1
History .....................................................................................................................
..............................
2
Chapter-2 ...........................................................................................................................
....................
3 Downloading & Installing Python
......................................................................................................... 3
2.1 Downloading python
...................................................................................................... .................
3
2.2 Installing Python .......................................................................................................
.......................
4
2.3 Setup the Path Variable
................................................................................................. ..................
5
2.4 Running The Python IDE
..................................................................................................
.............. 7
PROGRAMMING WITH PYTHON
Chapter-5
...........................................................................................................................
..................
14 Loops& conditional statements
........................................................................................................... 14
5.1 Loop definition
..............................................................................................................................
1
5.2 Conditional Statements:
................................................................................................. ................
15 5.3 Function
.............................................................................................................................
............
INTRODUCTION
Python is a widely used high-level, general-purpose,
interpreted, dynamic programming language. Its design
philosophy emphasizes code readability, and its syntax
allows programmers to express concepts in fewer lines
of code than would be possible in languages such as C++
or Java. The language provides constructs intended to
enable clear programs on both a small and large scale.
Scripting Language
A scripting or script language is a programming language
that supports scripts, programs written for a special runtime
environment that automate the execution of tasks that could
alternatively be executed one-by-one by a human operator.
PROGRAMMING WITH PYTHON
History
Chapter-2
Downloading & Installing
Python
About the Behind The Scene of Python origin of Python, Van Rossum wrote in
1996:
Over six years ago, in December 1989, I was looking for a "hobby"
programming project that would keep me occupied during the week
around Christmas. My office ... would be closed, but I had a home
Computer, and not much else on my hands. I decided to write an interpreter
for the new scripting language I had been thinking about lately: a descendant
of ABC that would appeal to Unix/C hackers. I chose Python as a working
title for the project, being in a slightly irreverent mood (and a big fan of Monty
Python's Flying Circus).
2.1 Downloading python
If you don’t already have a copy of Python installed on your
computer, you will need to open up your Internet browser and
go to the Python download page
(http://www.python.org/download/).
Now that you are on the download page, select which of the
software builds you would like to download. For the
purposes of this article we will use the most up to date
version available (Python 3.4.1).
Now you will scroll all the way to the bottom of the page and find
the
“Windows x86 MSI installer.” If you want to download
the 86-64 bit MSI, feel free to do so. We believe that even
if you have a 64-bit operating system installed on your
computer, the 86-bit MSI is preferable. We say this
because it will still run well and sometimes, with the
64bit architectures, some of the compiled binaries and
Python libraries don’t work well.
2.2 Installing
Python
If you are the only person who uses your computer, simply leave
the
“Install for all users” option selected. If you have multiple
accounts on your PC and don’t want
to install it across all accounts, select the “Install just for me”
option then press “Next.”
“x.” Choose the “Will be installed on local hard drive” option then
press
“Next.”
Simply enter a name for your Path and the code shown
below. For the purposes of this example we have installed
Python 2.7.3, so we will call the path: “Python path.” The
string that you will need to enter is:
“C:\Python27\;C:\Python27\Scripts;”
chapter-3
DATA TYPES & OPERATORS 3.1 Data types
3.2 Variables
Variables are nothing but reserved memory locations to store
values. This means that when you create a variable you
reserve some space in memory. Based on the data type of a
variable, the interpreter allocates memory and decides what
can be stored in the reserved memory. Therefore, by
assigning different data types to variables, you can store
integers, decimals or characters in these variables.
Ex: counter = 100 #
An integer assignment miles = 1000.0
# A floating point name = "John"
# A string
3.3 String
In programming terms, we usually call text a string. When you think of
a string as a collection of letters, the term makes sense.
Arithmetic Operators
Comparison Operator
Chapter-4
Tuples &list
4.1 Tuples
A tuple is a sequence of immutable Python objects. Tuples are
sequences, just like lists. The differences between tuples and lists
are, the tuples cannot be changed unlike lists and tuples use
parentheses.
Accessing Values in Tuples:
To access values in tuple, use the square brackets for slicing along
with the index or indices to obtain value available at that index.
For example − tup1 = ('physics',
'chemistry', 1997,
2000); tup2 = (1, 2, 3, 4, 5, 6, 7 ); print "tup1[0]: ", tup1[0] print
"tup2[1:5]: ", tup2[1:5] When the above code is executed, it
produces the following result − tup1[0]: physics tup2[1:5]: [2, 3,
4, 5]
LISTS
4.2 List
The list is a most versatile datatype available in Python which can
be written as a list of commaseparated values (items) between
square brackets.
Important thing about a list is that items in a list need not be of the
same type.
[2, 3, 4, 5]
Update: list = ['physics', 'chemistry', 1997, 2000]; print
"Value available at index 2 : " print list[2] list[2] = 2001; print
"New value available at index 2 : " print list[2]
Output: Value available at index 2 : 1997
New value available at index 2 : 2001
Chapter-5
Loops& conditional statements
5.1 Loop definition
Loop Example:
For Loop:
>>> for mynum in [1, 2, 3, 4, 5]:
print ("Hello", mynum )
Hello 1
Hello 2
Hello 3
Hello 4
:
>>> count = 0
>>while(count< 4): print
'The count is:', count
count = count + 1 The
count is:
0
The count is: 1
The count is: 2
The count is: 3
Example:
If
Stat
em
ent:
a=3 3
b=2
00 If
b>a:
print(
“b”)
If...E
lse
Statement
: a=200
b=33 if
b>a:
print(“b is greater than a”) else:
print(“a is greater than b”)
5.3 Function
The code block within every function starts with a colon (:) and is
indented.
Synte
x: Def functionname(param):
“function_docstring”
Function_suite
Return[expression] Def
printme(str):
“this print a passed string into this function”
print str return
1. # Function definition is here
def printme( str ):
"This prints a passed string into this
function" print str return;
# Now you can call printme function
printme("I'm first call to user defined
function!")
Python Class
A class is a collection of objects. A class contains the blueprints or the prototype
from which the objects are being created. It is a logical entity that contains some
attributes and methods.
To understand the need for creating a class let’s consider an example, let’s say you
wanted to track the number of dogs that may have different attributes like breed,
and age. If a list is used, the first element could be the dog’s breed while the second
element could represent its age. Let’s suppose there are 100 different dogs, then
how would you know which element is supposed to be which? What if you wanted
to add other properties to these dogs? This lacks organization and it’s the exact need
for classes.
Some points on Python class:
• Classes are created by keyword class.
• Attributes are the variables that belong to a class.
• Attributes are always public and can be accessed using the dot
(.) operator. Eg.: Myclass.Myattribute Class Definition Syntax: class
ClassName: # Statement-1
.
.
.
# Statement-N
Python Objects
The object is an entity that has a state and behavior associated with it. It may be any
real-world object like a mouse, keyboard, chair, table, pen, etc. Integers, strings,
floating-point numbers, even arrays, and dictionaries, are all objects. More
specifically, any single integer or any single string is an object. The number 12 is an
object, the string “Hello, world” is an object, a list is an object that can hold other
objects, and so on. You’ve been using objects all along and may not even realize it.
An object consists of:
• State: It is represented by the attributes of an object. It also reflects the
properties of an object.
• Behavior: It is represented by the methods of an object. It also reflects the
response of an object to other objects.
Output
My name is Rodger
My name is Tommy
Types of Inheritance
• Single Inheritance: Single-level inheritance enables a derived class to
inherit characteristics from a single-parent class.
• Multilevel Inheritance: Multi-level inheritance enables a derived class to
inherit properties from an immediate parent class which in turn inherits
properties from his parent class.
• Hierarchical Inheritance: Hierarchical-level inheritance enables more
than one derived class to inherit properties from a parent class.
• Multiple Inheritance: Multiple-level inheritance enables one derived
class to inherit properties from more than one base class. Inheritance in
Python
In the above article, we have created two classes i.e. Person (parent class) and
Employee (Child Class). The Employee class inherits from the Person class. We
can use the methods of the person class through the employee class as seen in the
display function in the above code. A child class can also modify the behavior of
the parent class as seen through the details() method.
Python3
self.name = name
self.idnumber = idnumber def
display(self):
print(self.name) print(self.idnumber)
def details(self):
print("My name is {}".format(self.name))
print("IdNumber: {}".format(self.idnumber))
# child class class Employee(Person): def __init__(self,
name, idnumber, salary, post): self.salary = salary
self.post = post
# invoking the __init__ of the parent class
Person.__init__(self, name, idnumber)
def details(self):
print("My name is {}".format(self.name))
print("IdNumber: {}".format(self.idnumber))
print("Post: {}".format(self.post))
Output Rahul
886012
My name is Rahul
IdNumber: 886012
Post: Intern
Note: For more information, refer to our Inheritance in Python tutorial
Encapsulation in Python
In the above example, we have created the c variable as the private attribute. We
cannot even access this attribute directly and can’t even change its value.
print(obj1.a)
# Uncommenting print(obj1.c) will
# raise an AttributeError
Data Abstraction
It hides unnecessary code details from the user. Also, when we do not want
to give out sensitive parts of our code implementation and this is where data
abstraction came.
Data Abstraction in Python can be achieved by creating abstract classes.
Object Oriented Programming in Python | Set 2 (Data Hiding and Object Printing)
Don't miss your chance to ride the wave of the data revolution! Every industry is
scaling new heights by tapping into the power of data. Sharpen your skills, become a
part of the hottest trend in the 21st century.
Dive into the future of technology - explore the Complete Machine Learning and
Data Science Program by GeeksforGeeks and stay ahead of the curve.
In this article, we’ll discuss how to connect to an SQLite Database using the sqlite3
••
module in Python.
Connecting to the Database
Connecting to the SQLite Database can be established using the connect() method,
passing the name of the database to be accessed as a parameter. If that database does
not exist, then it’ll be created. sqliteConnection = sqlite3.connect('sql.db')
But what if you want to execute some queries after the connection is being made.
For that, a cursor has to be created using the cursor() method on the connection
instance, which will execute our SQL queries. cursor = sqliteConnection.cursor()
print('DB Init')
The SQL query to be executed can be written in form of a string, and then executed
by calling the execute() method on the cursor object. Then, the result can be fetched
from the server by using the fetchall() method, which in this case, is the SQLite
Version Number.
Example: import
sqlite3 try:
Output:
Building GUI applications using the•• PYQT designer tool is comparatively less
timeconsuming than code the widgets. It is one of the fastest and easiest ways to
create GUIs.
The normal approach is to write the code even for the widgets and for the
functionalities as well. But using Qt-designer, one can simply drag and drop the
widgets, which comes very useful while developing big-scale applications.
Installation of PyQt5 :
Next
FINAL PROJECT
PROFILE OF THE PROBLEM Create a Fantasy Cricket game in Python. The
game should have all the features displayed in the mock-up screens in the
scenario. To calculate the points for each player, we can use rules similar to the
sample rules displayed below.
Sample of Rules
Bazng
● 1 point for 2 runs scored
● 1 point for hizng a boundary (four) and 2 points for over boundary (six)
Bowling
● 10 points for each wicket
● 4 points for economy rate (runs given per over) between 3.5 and 4.5
SOURCE CODE
def menu(self,ac)on): txt=(ac)on.text())
if txt=='NEW TEAM':
self.bat=0
self.bow=0
self.ar=0 self.wk=0
self.avl=1000
self.used=0
self.list1.clear()
self.list2.clear()
text,
ok=QtWidget.QInp
utDialog.getText(M
ainWindow,"team",
"enter name of team")
if
ok: self.t7.setText(str(text))
self.show() if
txt=='SAVE Team':
count=self.list2.count()
selected="" for i in range(count):
selected+=self.list2.item.text() if
i<count:
selected+=","
self.saveteam(self.t7.text(),selected,self.used)
if txt=='OPEN TEAM':
self.bat=0
self.bow=0 self.ar=0
self.wk=0
self.avl=1000
self.used=0
self.list1.clear()
self.list2.clear()
self.show()
self.openteam()
try:
cur=conn.excute(sql)
self.showdlg("team save
succesfully")
conn.commit() except:
self.showglg("error in opera)on")
conn.rollback() def
showdlg(self,msg):
Dialog=QtWidgets.QMessageBox()
Dialog.setText(msg)
Dialog.setWindowTitle("Dream Team selector")
ret=Dialog.exec()
if
_name=="main_":
bowlscore=bowlscore+4
fieldscore=(row[9]+row[10]+row[11])*10
CONCLUSION
This course has been an excellent and rewarding experience. I can conclude that
there have been a lot I’ve learnt from my work at there search centre. Needless to
say, the technical aspects of the work I’ve done are not flaw less and could be
improved provided enough )me. As someone with no prior experience in python .
whatsoever I believe my )me spent in research and discovering new languages was
well worth it and contributed to finding an acceptable solu)on to an important aspect
of web design and development. Two main things that I’ve learned the importance of
are )me-management skills and self-mo)va)on. Although I have oien stumbled upon
these problems at University, they had to be approached differently in a working
environment.
REFERENCE