0% found this document useful (0 votes)
13 views26 pages

Ip Practical File 2024-25

The document contains a practical list of Python programming exercises and Database Management System (DBMS) concepts. It includes various Python programs for loops, data manipulation using pandas, and data visualization with Matplotlib, alongside an introduction to DBMS, its features, advantages, and disadvantages. Additionally, it covers MySQL DDL commands and character functions.

Uploaded by

aajiya42
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views26 pages

Ip Practical File 2024-25

The document contains a practical list of Python programming exercises and Database Management System (DBMS) concepts. It includes various Python programs for loops, data manipulation using pandas, and data visualization with Matplotlib, alongside an introduction to DBMS, its features, advantages, and disadvantages. Additionally, it covers MySQL DDL commands and character functions.

Uploaded by

aajiya42
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

INDEX

S.No Practical List Remarks

PYTHON
1 W.A.P of for loop

2 W.A.P of while loop


3 Write a program to create and display one-dimensional array
4 Write a program to add, subtract, multiple and divide to pandas
5 W.A.P of Data Frame
Series
6 W.A.P to creating Data Frame from dict of ndarray lists
7 W.A.P of Dictionary in Python
8 W.A.P to create a plot in python
9 W.A.P to create a bar graph using Matplotlib
10 W.A.P of break statement
11 W.A.P of continue statement

Database Management System

12 Introduction of DBMS

(i) DDL Commands

(ii) DML Commands

13 MySQL Function
Program-1

num = int(input("Display multiplication table of = "))

for i in range(1, 11):

print(num, 'x', i, '=', num*i)

OUTPUT:-
Display multiplication table of = 11
11 x 1 = 11
11 x 2 = 22
11 x 3 = 33
11 x 4 = 44
11 x 5 = 55
11 x 6 = 66
11 x 7 = 77
11 x 8 = 88
11 x 9 = 99
11 x 10 = 110
Program-2

number = int(input ("Enter the number of which the user wants to


printthe multiplication table= "))

i=1

while i<= 10:

print (number, 'x', i, '=', number * i)


i=i+1

OUTPUT:-
Enter the number of which the user wants to print the multiplication table= 15
15 x 1 = 15
15 x 2 = 30
15 x 3 = 45
15 x 4 = 60
15 x 5 = 75
15 x 6 = 90
15 x 7 = 105
15 x 8 = 120
15 x 9 = 135
15 x 10 = 150
Program-3

import pandas as pd

ds = pd.Series([1, 3, 5, 7, 9])

print(ds)

OUTPUT:-
0 1

1 3

2 5

3 7

4 9

dtype: int64
Program-4

import pandas as pd

ds1 = pd.Series([2, 4, 6, 8, 10])

ds2 = pd.Series([1, 3, 5, 7, 9])

ds = ds1 + ds2

print("Add two Series:")

print(ds)

print("Subtract two Series:")

ds = ds1 - ds2

print(ds)

print("Multiply two Series:")

ds = ds1 * ds2

print(ds)

print("Divide Series1 by Series2:")

ds = ds1 / ds2

print(ds)
OUTPUT:-
Add two Series:
0 3
1 7
2 11
3 15
4 19
dtype: int64
Subtract two Series:
0 1
1 1
2 1
3 1
4 1
dtype: int64
Multiply two Series:
0 2
1 12
2 30
3 56
4 90
dtype: int64
Divide Series1 by Series2:
0 2.000000
1 1.333333
2 1.200000
3 1.142857
4 1.111111
dtype: float64
Program-5

import pandas as pd

data = {
"calories": [400, 300, 500], "duration": [150, 250, 450]
}

df = pd.DataFrame(data)

print(df)

OUTPUT:-
calories duration
0 400 150
1 300 250
2 500 450
Program-6

import pandas as pd

data = { 'Name': ['Tom', 'nick', 'krish', 'jack'], 'Age':[20, 21, 19, 18]}

df = pd.DataFrame(data)

print(df)

OUTPUT:-
Name Age
0 Tom 20
1 nick 21
2 krish 19
3 jack 18
Program-7

Employee = {"Name": "John", "Age": 29, "Salary":25000,"Company": "GOOGLE"}

print(type(Employee)) print("printing Employee data")

print(Employee)

OUTPUT:-
<class 'dict'>
printing Employee data
{'Name': 'John', 'Age': 29, 'Salary': 25000, 'Company': 'GOOGLE'}
Program-8

import matplotlib.pyplot as plt

x = [1,2,3]
y = [2,4,1]

plt.plot(x, y)

plt.xlabel('x - axis')

plt.ylabel('y - axis')

plt.title('My first graph!')

plt.show()

OUTPUT:-
Program-9

package bitwisexor;

from matplotlib import pyplot as plt

plt.bar([0.25,1.25,2.25,3.25,4.25],[50,40,70,80,20],
label="BMW",width=.5)
plt.bar([.75,1.75,2.75,3.75,4.75],[80,20,20,50,60],
label="Audi", color='r',width=.5)
plt.legend()
plt.xlabel('Days')
plt.ylabel('Distance (kms)')
plt.title('Information')
plt.show()

OUTPUT:-
Program-10

import matplotlib.pyplot as plt

population_age = [22,55,62,45,21,22,34,42,42,4,2,95,85,55, 70, 65,55,80,75,65,


54,44,43,42,48]

bins = [0,10,20,30,40,50,60,70,80,90,100]

plt.hist(population_age, bins, histtype='bar', rwidth=0.8)

plt.xlabel('age groups')

plt.ylabel('Number of people')

plt.title('Histogram')

plt.show()

OUTPUT:-
Program-11

import matplotlib.pyplot as plt

labels = 'Python', 'C++', 'Ruby', 'Java'

sizes = [215, 130, 245, 210]

colors = ['red', 'yellow', 'lightcoral', 'skyblue']

explode = (0.1, 0, 0, 0) # explode 1st slice

plt.pie(sizes, explode=explode, labels=labels, colors=colors, autopct='%1.1f%%')

plt.title('Pie Chart')

plt.axis('equal'

)plt.show()

OUTPUT:-
12. DATABASE MANAGEMENT SYSTEM
Database Management System is a software package designed to define,
manipulate, retrieve and manage data in database. A DBMS generally manipulates
the data itself, the data format ,field names , record structure and file structure. It
also defines rules to validate and manipulate this data.

A DBMS relieves user of framing programs for data maintenance. Fourth-


generation query languages , such as SQL, are used along with the DBMS package
to interact with a database.

Examples of DBMS: MySQL, SQL Server, Oracle, FoxPro etc.

TYPES OF DATABASE

The scope of Database Management System is not hidden from any organization.
Everyone knows how important database management system is if they want to
manage their precious data securely. Few most important features of database
management system are as follows:-

Features of Database Management System

o Minimum Duplication and redundancy.


o Save storage space and cost.
o Provides high level of security.
o Permanent storage of data.
Advantages of Database Management System
o Improved data sharing
o Improved data security
o Better data integration
o Increased end-user productivity
o Minimized data inconsistency

Disadvantages of Database Management System


o Increased cost
o Management complexity
o Damage to database affect virtually all application programs:
o Database Failure
o Performance
DDL MYSQL QUERIES
CREATE DATABASE AND SHOW DATABASES

CREATE TABLES, SHOW TABLES & DESC TABLE


TO MODIFY ANY COLUMN IN THE TABLE EXISTS
TO CHANGE ANY COLUMN NAME IN THE TABLE EXISTS
DDL MYSQL QUERIES

TO INSERT AND SELECT ROW IN THE TABLE

TO DELETE ROW IN THE TABLE


TO DROP A DATABASE
Program-13

CHARACTER FUNCTION

LOWER FUNCTION

UPPER FUNCTION

CONCAT STRING
INSTR FUNCTION

LENGTH FUNCTION

SUBSTR FUNCTION
ROUND FUNCTION

TRUNCATE FUNCTION

MOD FUNCTION
LAST_DAY ()

CURTIME ()

CURDATE ()
PATTERN OF NOW ()

You might also like