[go: up one dir, main page]

0% found this document useful (0 votes)
28 views21 pages

Fod Lab

Foundation of data science

Uploaded by

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

Fod Lab

Foundation of data science

Uploaded by

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

VIVEKANANDA INSTITUTE OF PROFESSIONAL STUDIES - TECHNICAL CAMPUS

Grade A++ Accredited Institution by NAAC


NBA Accredited for MCA Programme; Recognized under Section 2(f) by UGC;
Affiliated to GGSIP University, Delhi; Recognized by Bar Council of India and
AICTE An ISO 9001:2015 Certified Institution

SCHOOL OF ENGINEERING & TECHNOLOGY


BTECH Programme: AI&DS (3 rd. Semester)
Course Title: FOUNDATION OF DATA SCIENCE
Course Code: AI&DS 253

Submitted To: Dr. Alpna


Mishra
Submitted By
Name: ABHISHEK
Enrollment No:
VIVEKANANDA INSTITUTE OF PROFESSIONAL STUDIES - TECHNICAL CAMPUS

Grade A++ Accredited Institution by NAAC


NBA Accredited for MCA Programme; Recognized under Section 2(f) by UGC;
Affiliated to GGSIP University, Delhi; Recognized by Bar Council of India and
AICTE An ISO 9001:2015 Certified Institution

SCHOOL OF ENGINEERING & TECHNOLOGY

VISION OF INSTITUTE
To be an educational institute that empowers the field of
engineering to build a sustainable future by providing
quality education with innovative practices that supports
people, planet and profit.
MISSION OF INSTITUTE
To groom the future engineers by providing value-based
education and awakening students' curiosity, nurturing
creativity and building capabilities to enable them to make
significant contributions to the world.
VIVEKANANDA INSTITUTE OF PROFESSIONAL STUDIES - TECHNICAL CAMPUS
Grade A++ Accredited Institution by NAAC
NBA Accredited for MCA Programme; Recognized under Section 2(f) by UGC;
Affiliated to GGSIP University, Delhi; Recognized by Bar Council of India and
AICTE An ISO 9001:2015 Certified Institution

SCHOOL OF ENGINEERING & TECHNOLOGY

S.NO Experiment Date Laboratory Class Viva Remark Faculty


Assessment Participation signature
(15 marks) (5 marks) (5marks)
EXPERIMENT-1
Aim: Introduction and installation of python IDEs for data science
(spyder, jupyter notebook etc.)
Theory:

Download and install python:


Before starting with installation process we can take a look
here at all the versions of python.

Download the required version and follow the given


instructions: Installation process:
Installing libraries, pip and other features:

Finish installing:

Installed version:
Anaconda navigator:

Output:
EXPERIMENT-2
Aim: To design a python program that generates a list of square of
numbers between 1 and 30, print the list excluding the first 5
element.
Theory:

Source code:
a = [x**2 for x in range(1, 31)]square = a[5:]
print(square)

Output:
EXPERIMENT-3.1
Aim: Design a python program to understand the working of
loops.
(a) Reverse a given string using both For and While
loop. Theory:

Source code
# Reverse with for loop
def reverse_with_for(string):
return ''.join(string[i] for i in range(len(string) - 1, -1, -1))

# Reverse with while loop


def reverse_with_while(string):
reversed_string, index = '', len(string) - 1 while index
>= 0:
reversed_string +=
string[index] index -= 1

Output:
EXPERIMENT-3.2
Aim: Design a python program to understand the working of
loops.
(b)write a program to find the sum of the digits of a given
number. Theory:

Source code:
defsum_of_digits(number): total = 0
while number > 0:
total += number % 10 number //=
10
return total
number = int(input("Enter a number to find the sum of its digits: ")) print("Sum of digits:",
sum_of_digits(number))

Output:
EXPERIMENT-3.3
Aim: Design a python program to understand the working of
loops.
(c)To find factorial of a number.
Theory:

Source code:
deffactorial(number): result = 1
for i in range(1, number + 1): result *=
i return result
number = int(input("Enter a number to find its factorial: ")) print("Factorial:", factorial(number))

Output:
EXPERIMENT-3.4
Aim: Design a python program to understand the working of
loops.
(d)To generate Fibonacci series.
Theory:

Source code:
deffibonacci_series(n): a, b = 0, 1
series = [] while a <=
n:
series.append(a) a, b =
b, a + b
return series
n = int(input("Enter the maximum number for Fibonacci series: ")) print("Fibonacci series:",
fibonacci_series(n))

Output:
EXPERIMENT-3.5
Aim: Design a python program to understand the working of
loops.
(e)write a program to print the following pattern (equilateral
triangle). Theory:

Source code:
def print_triangle(rows):
for i in range(1, rows + 1):
print(' ' * (rows - i) + '*' * (2 * i - 1))
rows = int(input("Enter the number of rows for the equilateral triangle: "))
print_triangle(rows)

Output:
EXPERIMENT-4
Aim: To design a python function that determine and return
the maximum of three given number.
Theory:

Source code:
def maximum_of_three(a, b, c): if a >= b
and a >= c:
return a
elif b >= a and b >= c: return
b else:
return c
num1 = float(input("Enter the first number: ")) num2 =
float(input("Enter the second number: ")) num3 = float(input("Enter the
third number: "))

print("The maximum number is:", maximum_of_three(num1, num2, num3))

Output:
EXPERIMENT-5
Aim: Design a python program for creating a random story
generator.
Theory:

Source code:
import random

def generate_story():
characters = ["a lost astronaut","a clever detective","a young princess", "an old sorcerer",
"a daring pirate"]

settings = ["in a futuristic city","in a hidden underground cave","on a deserted island",


"in a bustling marketplace","in an enchanted forest"]

plots = ["finds a mysterious artifact","solves a puzzling mystery","escapes from


danger", "uncovers an ancient secret","makes a new friend"] character =
random.choice(characters)
setting = random.choice(settings) plot
= random.choice(plots)

story = f"One day, {character} {setting} {plot}. The adventure that followed was like nothing ever
seen before."
Output:
EXPERIMENT-6
Aim: Create a synthetic dataset(.csv/.xlsx) to work upon and
design a python program to read and print that data.
Theory:

.csv files:
StudentID,FirstName,LastName,Age,Grade,Major S001,Alok,pal,20,Junior,Computer Science
S002,Mahesh,kumar,21,Senior,Mathematics S003,Keshaw,yadav,19,Sophomore,Biology
S004,Ramu,roy,22,Senior,Chemistry

Source code:
import pandas as pd
def read_csv(file_path):
df = pd.read_csv(file_path) return df
csv_file_path = '06_.csv' data =
read_csv(csv_file_path) print("Data from
CSV file:") print(data)

Output:

You might also like