Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

python

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

python

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
DATA VISUALIZATION WITH PYTHON(BCS358D)
INTERNAL EVALUATION SHEET
EVALUATION (MAX MARKS 50)
REGULAR
TEST RECORD TOTAL MARKS
EVALUATION
A C A+B+C
B
20 20 10 50

R1: REGULAR LAB EVALUATION WRITE UP & PROGRAM EXECUTION RUBRIC


(MAX MARKS 10)

Sl.
Needs
No Parameters Good Average
improvement
.
Problem statement
Problem statement is understood
Understanding Clear understanding of problem is not clearly
clearly but few mistakes while
a. of problem statement while designing and understood while
designing and implementing
(2 marks) implementing the program (2) designing the
program (1)
program (0)
Writing Program does not
Program handles all possible Average condition is defined and
b. program handle possible
conditions (2) verified. (1)
(2 marks) conditions (0)
Design, Program follows syntax and
Program has few logical errors, Syntax and
implementation semantics of C programming
moderately demonstrates all semantics of C
c. , and language. Demonstrates the
possible concepts implemented in programming is
demonstration complete knowledge of the
programs (2) not clear (1)
(3 marks) program written (3)
Result and Documentation
Meticulous documentation and all Acceptable documentation shown
d. documentation does not take care
conditions are taken care (3) (2)
(3 marks) all conditions (1)

R2: REGULAR LAB EVALUATION VIVA RUBRIC (MAX MARKS 10)


Sl. Needs
Parameter Excellent Good Average
No. Improvement
Conceptual Answer 80% of the Answers 30% of
Answers 60% of the viva
understanding viva questions and the viva questions Unable to
questions and execution of
a. & Additional execution of and execution of relate the
Additional programs listed
Programming Additional programs Additional concepts (1)
(7)
(10 marks) listed (10) programs listed(4)

R3: RECORD EVALUATION RUBRIC (MAX MARKS 10)


Sl. Needs
Parameter Excellent Good Average
No. Improvement
Meticulous record writing Write up contains Program
Write up
Documentation including program, comments program, but written with
a. contains only
(10 marks) and as per the guidelines comments are not few mistakes
program (6)
mentioned (10) included (8) (5)

Test 1 (8th Week) Test 2 (14th Week)


(50 Marks) (50 Marks)

Write up Execution Viva Write up Execution Viva


20 20 10 20 20 10

Dept. of CSE Page | 1


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
SYLLABUS
Data Visualization with Python(BCS358D)
Course Code BCS358D CIE Marks 50
Number of Contact Hours/Week 0:0:2:0 SEE Marks 50
Total Number of Lab Contact Hours 24 Exam Hours 03
Credits –1
Descriptions(if any):

Programs List:

a) Write a python program to find the best of two test average marks out of three test’s marks
accepted from the user.
1.
b) Develop a Python program to check whether a given number is palindrome or not and also
count the number of occurrences of each digit in the input number.
a) Defined as a function F as Fn = Fn-1 + Fn-2. Write a Python program which accepts a value
for N (where N >0) as input and pass this value to the function. Display suitable error message
2. if the condition for input value is not followed.
b) Develop a python program to convert binary to decimal, octal to hexadecimal using
functions.
a) Write a Python program that accepts a sentence and find the number of words, digits,
uppercase letters and lowercase letters.
b) Write a Python program to find the string similarity between two given strings
Sample Output: Sample Output:
3 Original string: Original string:
Python Exercises Python Exercises
Python Exercises Python Exercise
Similarity between two said strings: Similarity between two said strings:
1.0 0.967741935483871
a)Write a Python program to Demonstrate how to Draw a Bar Plot using Matplotlib.
4
b) Write a Python program to Demonstrate how to Draw a Scatter Plot using Matplotlib.
a) Write a Python program to Demonstrate how to Draw a Histogram Plot using Matplotlib.
5.
b) Write a Python program to Demonstrate how to Draw a Pie Chart using Matplotlib
a) Write a Python program to illustrate Linear Plotting using Matplotlib.
6 b) Write a Python program to illustrate liner plotting with line formatting using Matplotlib.
a) Write a Python program which explains uses of customizing seaborn plots with Aesthetic
7. functions.
Write a Python program to explain working with bokeh line graph using Annotations and
8 Legends.
a) Write a Python program for plotting different types of plots using Bokeh
9 Write a Python program to draw 3D Plots using Plotly Libraries.
a) Write a Python program to draw Time Series using Plotly Libraries.
10
b) Write a Python program for creating Maps using Plotly Libraries.

PART B – Practical Based Learning


A problem statement for each batch is to be generated in consultation with the co-examiner and student
should develop an algorithm, program and execute the program for the given problem with appropriate
outputs.

Dept. of CSE Page | 2


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
Course Objectives and Course Outcomes

COURSE LEARNING OBJECTIVES: This course will enable students to


1. Demonstrate the use of IDLE or PyCharm IDE to create Python Applications
2. Using Python programming language to develop programs for solving real-world problems
3. Implementation of Matplotlib for drawing different Plots
4. Demonstrate working with Seaborn, Bokeh.
5. Working with Plotly for 3D, Time Series and Maps.
Course Outcomes: At the end of this course, students are able to:
CO1 Interpret the syntax and semantics of the Python programming language.
CO2 Illustrate the data types and signify the usage of built-in functions of Python.
CO3 Implement Matplotlib to create various types of plots
CO4 Illustrate the usage of Seaborn and Bokeh
CO5 Illustrate Plotly for creating 3D visuals, handling time series data, and generating maps.

CO-PO-PSO Matrix

COURSE
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3 PSO4
OUTCOMES
CO1 3 2 2
CO2 3 2 2
CO3 3 2 2
CO4 3 2 2
CO5 3 2 2

1.a )Write a python program to find the best of two test average marks out of three test’s marks
accepted from the use

m1 = int(input("Enter marks for test1 : "))


m2 = int(input("Enter marks for test2 : "))
m3 = int(input("Enter marks for test3 : "))
if m1 <= m2 and m1 <= m3:
avgMarks = (m2+m3)/2
elif m2 <= m1 and m2 <= m3:
avgMarks = (m1+m3)/2
elif m3 <= m1 and m2 <= m2:
avgMarks = (m1+m2)/2
print("Average of best two test marks out of three test’s marks is", avgMarks);

OR
m1=int(input("Enter the test1 Marks"))
m2=int(input("Enter the test2 Marks"))
m3=int(input("Enter the test3 Marks"))
L1=[]
L1.append(m1)
L1.append(m2)

Dept. of CSE Page | 3


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
L1.append(m3)
L1.sort()
print(L1)
Avg=(L1[1]+L1[2])/2
print("Average of best two test marks out of three test’s marks is ",Avg)

output
Enter the test1 Marks 25
Enter the test2 Marks 25
Enter the test3 Marks 12
[12, 25, 25]
Average of Best of two Test is 25.0

OR
m1=int(input("Enter the test1 Marks"))
m2=int(input("Enter the test2 Marks"))
m3=int(input("Enter the test3 Marks"))
Minimum=min(m1,m2,m3)
sum=m1+m2+m3-Minimum
Avg=sum/2
print("Average of best two test marks out of three test’s marks is ",Avg)

1.b)Develop a Python program to check whether a given number is palindrome or not and #also count
the number of occurrences of each digit in the input number.

val = int(input("Enter a value : "))


str_val = str(val)
if str_val == str_val[::-1]:
print("Palindrome")
else:
print("Not Palindrome")

for i in range(10):
if str_val.count(str(i)) > 0:
print(str(i),"appears", str_val.count(str(i)), "times");

OR

num=input("Enter the Number")


rev=num
if (rev==rev[::-1]):
print("The Number is Palindrome", num)
else:
print("The Number is not Palindrome", num)
for i in set(num):
print(i, "appears", num.count(str(i)),"times")

output
Enter the Number12321
The Number is Palindrome 12321

Dept. of CSE Page | 4


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
1 appears 2 times
3 appears 1 times
2 appears 2 times

2. a) Defined as a function F as Fn = Fn-1 + Fn-2. Write a Python program which accepts a value
for N (where N >0) as input and pass this value to the function. Display suitable error message if
the condition for input value is not followed.

def Fibonacci(n):
if n==1:
return 0
elif n==2:
return 1
else:
return (Fibonacci(n-1)+Fibonacci(n-2))

num=int(input("Enter the number\n"))


if num>0:
res=Fibonacci(num)
print("Fibonacci of ", num ,"is",res)
else:
print("Error in the input")

Output
Enter the number 5
Fibonacci of 5 is 3

Enter the number -9


Error in input

2.b) Develop a python program to convert binary to decimal, octal to hexadecimal using
functions.
def Bin2dec(bin):
l=len(bin)
dec=0
for i in range(l):
dec+=int(bin[i])*(2**(l-i-1))
return dec

def oct2hex(oct):
l=len(oct)
dec=0
for i in range(l):
dec+=int(oct[i])*(8**(l-i-1))
hexa=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F']
octhex=' '
while dec>0:
rem=dec%16
octhex=hexa[rem]+octhex

Dept. of CSE Page | 5


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
dec=dec//16
return octhex

bin=input("Enter the Binary Number")


print("Binary to Decimal is ",Bin2dec(bin))
oct=input("Enter the octal Number")
print("Octal to Decimal is",oct2hex(oct))

OUTPUT:
Enter the Binary Number1011
Binary to Decimal is 11
Enter the octal Number12
Octal to Decimal is A

3. a) Write a Python program that accepts a sentence and find the number of words, digits,
uppercase letters and lowercase letters.
sentence = input("Enter a sentence : ")
digCnt = upCnt = loCnt =wordcnt=0
wordcont=sentence.split()
for ch in sentence:
if ch>='0' and ch<='9':
digCnt += 1
if ch>='A'and ch<='Z':
upCnt += 1
if ch>='a' and ch<='z':
loCnt += 1

print("This sentence has\n")


print("words: ", len(wordcont),"\n" "digits",digCnt, )
print("upper case letters",upCnt, "\n" "lower case letters ",loCnt)
Output
Enter a sentence : Hello RNSIT, 2001 &
This sentence has

words: 4
digits 4
upper case letters 6
lower case letters 4

3.b) Write a Python program to find the string similarity between two given strings
def compare(s,p):
count=0
n=min(len(s),len(p))
for i in range(n):
if s[i]==p[i]:
count+=1
return count
s1 = input("Enter String 1 \n")
s2 = input("Enter String 2 \n")
mx=max(len(s1),len(s2))
count=compare(s1,s2)
similarity=count/mx*100

Dept. of CSE Page | 6


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
print ("Total number letter matched is",count)
print("simirality between two string is",similarity)

Output
Enter String 1
rnsit
Enter String 2
rnsit
Total number letter matched is 5
simirality between two string is 100.0

Enter String 1
welcome
Enter String 2
rnsit
Total number letter matched is 0
simirality between two string is 0.0

4.a ) Write a Python program to Demonstrate how to Draw a Bar Plot using Matplotlib.
import matplotlib.pyplot as plt
plt.bar([1,3,5,7,9],[5,2,7,8,2], label="Data 1")
plt.legend()
# The following commands add labels to our figure.
plt.xlabel('X values')
plt.ylabel('Height')
plt.title('Vertical Bar chart')
plt.show()
OUTPUT

Or
import matplotlib.pyplot as plt
plt.barh(["Cats","Dogs","Goldfish","Snakes","Turtles"],
[5,2,7,8,2], align='center', label="Data 1")
plt.legend()

Dept. of CSE Page | 7


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
plt.ylabel('Pets')
plt.xlabel('Popularity')
plt.title('Popularity of pets in the neighbourhood')
plt.show()

OUTPUT

4 b) Write a Python program to Demonstrate how to Draw a Scatter Plot using


Matplotlib.

import matplotlib.pyplot as plt

x =[5, 7, 8, 7, 2, 17, 2, 9, 4, 11, 12, 9, 6]

y =[99, 86, 87, 88, 100, 86, 103, 87, 94, 78, 77, 85, 86]

plt.scatter(x, y, c ="blue")

plt.show()

OUTPUT

Dept. of CSE Page | 8


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
5 a) Write a Python program to Demonstrate how to Draw a Histogram Plot using
Matplotlib.

from matplotlib import pyplot as plt

import numpy as np

a = np.array([22, 87, 5, 43, 56, 73, 55, 54, 11, 20, 51, 5, 79, 31,27])

fig, ax = plt.subplots(figsize =(10, 7))

ax.hist(a, bins = [0, 25, 50, 75, 100])

plt.show()

OUTPUT:

5 b) Write a Python program to Demonstrate how to Draw a Pie Chart using Matplotlib.

from matplotlib import pyplot as plt

import numpy as np

cars = ['AUDI', 'BMW', 'FORD','TESLA', 'JAGUAR', 'MERCEDES']

data = [23, 17, 35, 29, 12, 41]

fig = plt.figure(figsize =(10, 7))

plt.pie(data, labels = cars)

plt.show()

OUTPUT:

Dept. of CSE Page | 9


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]

6 a) Write a Python program to illustrate Linear Plotting using Matplotlib.

import matplotlib.pyplot as plt

X = [1,2,3,4,5] # X-axis points

Y = [2,4,6,8,10] # Y-axis points

plt.plot(X,Y) # Plotting the line plot

plt.show() #Displaying the plot

6 b) Write a Python program to illustrate liner plotting with line formatting using
Matplotlib.

import matplotlib.pyplot as plt


import random as random
studentsusn = ["01","02","03","04","05","06","07","08","09","10"]
marks=[]
for i in range(0,len(studentsusn)):
marks.append(random.randint(0, 101))

Dept. of CSE Page | 10


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
plt.xlabel("Students")
plt.ylabel("Marks")
plt.title("CLASS RECORDS")
plt.plot(studentsusn,marks, color = 'green', linestyle = 'solid', marker = 'o', markerfacecolor =
'red', markersize = 15)

OUTPUT

7 a) Write a Python program which explains uses of customizing seaborn plots with
Aesthetic functions.

import seaborn as sns

import matplotlib.pyplot as plt

data = sns.load_dataset("iris")

sns.lineplot(x="sepal_length", y="sepal_width", data=data)

sns.set_style("darkgrid")

plt.show()

Dept. of CSE Page | 11


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
OUTPUT

8 a) Write a Python program to explain working with bokeh line graph using Annotations and
Legends.

from bokeh.plotting import figure, output_file, show

graph = figure(title="Bokeh Line Graph")

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

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

graph.line(x, x, legend_label="Line 1")

graph.line(y, x, legend_label="Line 2", line_color="green")

show(graph)

OUTPUT:

Dept. of CSE Page | 12


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
8. b) Write a Python program for plotting different types of plots using Bokeh.

from bokeh.io import output_file as OF

from bokeh.io import show

from bokeh.layouts import row

from bokeh.plotting import figure as figs

fig1 = figs(plot_width = 400,plot_height = 400, title = "Plot 1")

fig1.line([2, 1, 5, 3, 4, 7, 6],[1, 4, 3, 5, 2, 7, 7],line_width = 4)

x = y = list(range(10))

fig2 = figs(plot_width = 400,plot_height = 400, title = "Plot 2")

fig2.circle(x, y, size = 5)

show(row(fig1, fig2))

OUTPUT:

OR

from bokeh.io import output_file as OF

from bokeh.io import show

from bokeh.layouts import row

from bokeh.plotting import figure as figs

x = y = list(range(10))

Dept. of CSE Page | 13


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
xs = [[[[1, 1, 2, 2]]]]

ys = [[[[4, 3, 3, 4]]]]

fig1 = figs(title = "Plot 1", plot_width = 250, plot_height = 250)

fig1.line(x, y, line_width = 25, color = "Orange")

fig2 = figs(title = "Plot 2", plot_width = 250, plot_height = 250)

fig2.circle(x, y, size = 25, color = "Blue")

fig3 = figs(title = "Plot 3", plot_width = 250, plot_height = 250)

fig3.square(x, y, size = 25, color = "Green")

fig4 = figs(title = "Plot 4", plot_width = 250,plot_height = 250)

fig4.triangle(x, y, size = 25, color = "RED")

fig5 = figs(title = "Plot 5", plot_width = 250, plot_height = 250)

fig5.multi_polygons(xs, ys, color = "Blue")

fig6 = figs(title = "Plot 6", plot_width = 250, plot_height = 250)

fig6.line(x, y, line_dash = "dotted", color = "Green")

show(row(fig1, fig2, fig3, fig4, fig5, fig6))

output:

9. a) Write a Python program to draw 3D Plots using Plotly Libraries.

import plotly.express as px

df = px.data.iris()

fig = px.scatter_3d(df, x = 'sepal_width',

Dept. of CSE Page | 14


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
y = 'sepal_length',

z = 'petal_width',

color = 'species',

size='petal_length',

size_max = 20,

opacity = 0.5)

fig.show()

10. a) Write a Python program to draw Time Series using Plotly Libraries.

import pandas as pd

import plotly.express as px

tsla = pd.read_csv('C:/Users/Admin/OneDrive/Desktop/Tesla.csv')

tsla.head()

fig = px.line(tsla, x='Date', y="Close")

fig.show()

fig = px.line(tsla, x='Date', y="Close")

Dept. of CSE Page | 15


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
fig.show()

10 b) Write a Python program for creating Maps using Plotly Libraries.

import plotly.graph_objects as go

import plotly.express as px

url = 'C:/Users/Admin/Downloads/Places.csv'

data = pd.read_csv(url, header='infer')

data.head()

data = data.rename(columns = {'POIs':'Place'})

data.head()

fig = px.scatter_mapbox(data, lat="LATITUDE", lon="LONGITUDE", hover_name="Place",


hover_data=["Place"], color_discrete_sequence=["darkmagenta"], zoom=5.5, height=300)

fig.update_layout(mapbox_style="open-street-map")

fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})

fig.show()

Dept. of CSE Page | 16


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]

Sample Programs
1. Python program to print "Hello Python"
print ('Hello Python')

2. Python program to do arithmetical operations


# Store input numbers:
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')

# Add two numbers


sum = float(num1) + float(num2)
# Subtract two numbers
min = float(num1) - float(num2)
# Multiply two numbers
mul = float(num1) * float(num2)
#Divide two numbers
div = float(num1) / float(num2)
# Display the sum
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

# Display the subtraction


print('The subtraction of {0} and {1} is {2}'.format(num1, num2, min))
# Display the multiplication
print('The multiplication of {0} and {1} is {2}'.format(num1, num2, mul))
# Display the division
print('The division of {0} and {1} is {2}'.format(num1, num2, div))

3. Python program to find the area of a triangle


a=5
b=6
c=7
# Uncomment below to take inputs from the user
# a = float(input('Enter first side: '))
# b = float(input('Enter second side: '))
# c = float(input('Enter third side: '))
# calculate the semi-perimeter
s = (a + b + c) / 2
# calculate the area

Dept. of CSE Page | 17


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
print('The area of the triangle is %0.2f' %area)

4. Python program to swap two variables


#swapping of 2 numbers
p=int(input("enter the value of a"))
q=int(input("enter the value of b"))
print('Before Swapping the value of p=',p,'and q=',q)
temp=p
p=q
q=temp
print('After swapping the value of p=',p,'and q=',q)

5. Python program to find the sum and average of natural numbers up to n where n is provided by
user.
n=int(input("Enter upto which number you want sum and average"))
sum=0
for i in range(0,n+1):
sum=sum+i
avg=sum/n
print("Result of sum is",sum)
print("Result of Average",avg)

6. WAP to find Factorial of a number using for loop


fact=1
n=int(input("enter the value of n to find factorial of a given number"))
for i in range(1,n+1) :
fact=fact*i
print(fact)

7. WAP to find Factorial of a number using while loop


fact=1
i=1
n=int(input("enter the value of n to find factorial of a given number"))
while i<=n :
fact=fact*i
i=i+1
print(fact)

8. WAP to find fibonacci series using Iterative:


n = int(input("How many terms? "))
n1, n2 = 0, 1
count = 0
if n <= 0:
print("Please enter a positive integer")
elif n == 1:
print("Fibonacci sequence upto",n,":")
print(n1)
else:
print("Fibonacci sequence:")
while count < n:
print(n1)
next = n1 + n2
n1 = n2
n2 = next
count += 1

Dept. of CSE Page | 18


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]

9. WAP to find fibonacci series using recursion:


def fib(n):
if n <= 1:
return n
else:
return(fib(n-1) + fib(n-2))

nterms = int(input("How many terms? "))


if nterms<= 0:
print("Plese enter a positive integer")
else:
print("Fibonacci sequence:")
for i in range(nterms):
print(fib(i))

10 . WAP to find largest among three numbers, input by user


n1=int(input("enter first number"))
n2=int(input("enter sec number"))
n3=int(input("enter third number"))

if n1>n2 and n1>n3 :


print("n1 is larger")
elif n2>n3 and n2>n1 :
print("n2 is larger")
else :
print("n3 is larger")

11. WAP to print first ten programs using for loop .


for i in range(1,11) :
print(i)

12. WAP to print first ten programs using while loop.


I=1
while i<=10:
print(i)
i=i+1

13. WAP to check whether a person is eligible for voting.


age=input()
type(age)
x=int(age)
if x>18 :
print("eligible")
else :
print("not ")

14. WAP to print grades obtained by the students and print the appropriate message.
marks=input()
type(marks)
x=int(marks)
if x>=90 and x<100:
print('distinction')
elif x>=80 and x<=90:
print("first")
else :

Dept. of CSE Page | 19


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
print("fail")

15.WAP to find factorial of given number using for loop.


fact=1
for i in range(1,6) :
fact*=i
print(fact)

16.WAP to find factorial of given number using while loop.


fact=1
i=1
n=int(input())
while i<=n:
fact=fact*i
i=i+1
print(fact)

17. WAP to find factorial of given number using functions.


def fact(n) :
fact=1
i=1
while i<=n :
fact*=i
i=i+1
return fact
#print(fact)
n=int(input("enter the number to find factoral of a given number"))
print(fact(n))

18.WAP to find gcd of 2 numbers.


def gcd(a,b):
if b==0:
return a
else :
return gcd(b,a%b)
n1=int(input("enter the first number"))
n2=int(input("enter the second number"))
print(gcd(n1,n2))

19. Python program to generate a random number


20. Python program to convert kilometers to miles.
21. Python program to convert Celsius to Fahrenheit
22. Python program to display calendar
23. Python Program to Check if a Number is Positive, Negative or Zero
24. Python Program to Check if a Number is Odd or Even
25. Python Program to Check Leap Year
26. Python Program to Check Prime Number
27. Python Program to Print all Prime Numbers in an Interval
28. Python Program to Find the Factorial of a Number
29. Python Program to Display the multiplication Table
30. Python Program to Print the Fibonacci sequence
31.Python Program to Check Armstrong Number
32.Python Program to Find Armstrong Number in an Interval

Dept. of CSE Page | 20


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
Python Additional Programs
1. Python program to print "Hello Python"
2. Python program to do arithmetical operations
3. Python program to find the area of a triangle
4. Python program to solve quadratic equation
5. Python program to swap two variables
6. Python program to generate a random number
7. Python program to convert kilometers to miles
8. Python program to convert Celsius to Fahrenheit
9. Python program to display calendar
10. Python Program to Check if a Number is Positive, Negative or Zero
11. Python Program to Check if a Number is Odd or Even
12. Python Program to Check Leap Year
13. Python Program to Check Prime Number
14. Python Program to Print all Prime Numbers in an Interval
15. Python Program to Find the Factorial of a Number
16. Python Program to Display the multiplication Table
17. Python Program to Print the Fibonacci sequence
18. Python Program to Check Armstrong Number
19. Python Program to Find Armstrong Number in an Interval
20. Python Program to Find the Sum of Natural Numbers
21. Python Function Programs
22. Python Program to Find LCM
23. Python Program to Find HCF
24. Python Program to Convert Decimal to Binary, Octal and Hexadecimal
25. Python Program To Find ASCII value of a character
26. Python Program to Make a Simple Calculator
27. Python Program to Display Calendar
28. Python Program to Display Fibonacci Sequence Using Recursion
29. Python Program to Find Factorial of Number Using Recursion
30. Python Number Programs
31. Python program to check if the given number is a Disarium Number
32. Python program to print all disarium numbers between 1 to 100
33. Python program to check if the given number is Happy Number
34. Python program to print all happy numbers between 1 and 100
35. Python program to determine whether the given number is a Harshad Number
36. Python program to print all pronic numbers between 1 and 100
37. Python Array Programs
38. Python program to copy all elements of one array into another array
39. Python program to find the frequency of each element in the array
40. Python program to left rotate the elements of an array
41. Python program to print the duplicate elements of an array
42. Python program to print the elements of an array
43. Python program to print the elements of an array in reverse order
44. Python program to print the elements of an array present on even position
45. Python program to print the elements of an array present on odd position
46. Python program to print the largest element in an array

Dept. of CSE Page | 21


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
47. Python program to print the smallest element in an array
48. Python program to print the number of elements present in an array
49. Python program to print the sum of all elements in an array
50. Python program to right rotate the elements of an array
51. Python program to sort the elements of an array in ascending order
52. Python program to sort the elements of an array in descending order

Viva Questions:
1. What it the syntax of print function?
2. What is the usage of input function?
3. Define a variable.
4. What is type conversion?
5. Mention the data types in Python
6. What are the attributes of the complex datatype?
7. Mention a few escape sequences.
8. Define an expression
9. What is the usage of ** operator in Python?
10. Give the syntax of if else statement.
11. Give the syntax of for statement.
12. How is range function used in for?
13. Give the syntax of while statement.
14. What are multi way if statements?
15. How is random numbers generated?
16. Define a function.
17. Give the syntax of function.
18. What are the types of arguments in function.?
19. What is a recursive function?
20. What are anonymous functions?
21. What are default arguments?
22. What are variable length arguments?
23. What are keyword arguments?
24. Mention the use of map().
25. Mention the use of filter().
26. Mention the use of reduce().
27. Define a string.
28. How is string slicing done?
29. What is the usage of repetition operator?
30. How is string concatenation done using + operator>
31. Mention some string methods
32. How is length of a string found?
33. How is a string converted to its upper case?
34. `Differentiate isalpha() and isdigit().
35. What is the use of split()?
36. Define a file.
37. Give the syntax for opening a file.

Dept. of CSE Page | 22


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
38. Give the syntax for closing a file.
39. How is reading of file done?
40. How is writing of file done?
41. What is a list?
42. Lists are mutable-Justify.
43. How is a list created?
44. How can a list be sorted?
45. How are elements appended to the list?
46. How is insert() used in list?
47. What is the usage of pop() in list?
48. Define a tuple.
49. Are tuples mutable or immutable?
50. Mention the use of return statement.
51. What is a Boolean function?
52. How is main function defined?
53. What is a dictionary?
54. How are tuples created?
55. How is a dictionary created?
56. How to print the keys of a dictionary?
57. How to print the values of a dictionary?
58. How is del statement used?
59. Can tuple elements be deleted?
60. What is Python interpreter?
61. Why is Python called an interpreted language?
62. Mention some features of Python
63. What is Python IDLE?
64. Mention some rules for naming an identifier in Python.
65. Give points about Python Numbers.
66. What is bool datatype?
67. Give examples of mathematical functions.
68. What is string formatting operator?
69. Mention about membership operators in Python.
70. How is expression evaluated in Python?
71. What are the loop control statements in Python?
72. What is the use of break statement?
73. What is the use of continue statement?
74. What is the use of pass statement?
75. What is assert statement?
76. Differentiate fruitful function s and void functions.
77. What are required arguments ?
78. Differentiate pass by value and pass by reference.
79. Mention few advantages of function.
80. How is lambda function used?
81. What is a local variable?
82. What are global variables?

Dept. of CSE Page | 23


Data Visualization with Python (BCS358D)

[DOCUMENT TITLE]
83. What are Python decorators?
84. Are strings mutable or immutable?
85. What is join()?
86. What is replace() method?
87. What is list comprehension?
88. Define multidimensional list.
89. How to create lists using range()?
90. What is swapcase() method?
91. What is linear search?
92. How is binary search done?
93. How is merge sort performed?
94. What is sorting?
95. How is insertion sort done?
96. How is selection sort done?
97. What are command line arguments?
98. Name some built in functions with dictionary.
99. What is an exception?
100. How is exception handled in python?

Dept. of CSE Page | 24

You might also like