MANNAR THIRUMALAI NAICKER COLLEGE (AUTONOMOUS)
Affliated to Madurai Kamaraj University
Re-Accredited with 'A+' Grade by NAAC
Pasumalai, Madurai - 625004
PYTHON AND R FOR DATA
ANALYTICS
PG DEPARTMENT OF COMMERCE WITH COMPUTER APPLICATIONS
PRACTICAL EXAMINATIONS – NOVEMEBER 2025
MANNAR THIRUMALAI NAICKER COLLEGE (AUTONOMOUS)
Affliated to Madurai Kamaraj University
Re-Accredited with 'A+' Grade by NAAC
Pasumalai, Madurai - 625004
PG DEPARTMENT OF COMMERCE WITH COMPUTER APPLICATIONS
BONAFIDE CERTIFICATE
Name :
Class : II [Link](CA) [Link]. :
Subject : Python and R for Data Analytics - Lab Semester : III
Sub-Code : 24PCCSP31
This is to certify that this record is a bonafide worked one by the above mentioned student.
The certificate is awarded for the same.
STAFF IN - CHARGE HEAD OF THE DEPARTMENT
[Link] [Link].,[Link].,[Link].,NET., [Link] [Link].,[Link].,SET.,
Submitted for Practical Examination held on at Mannar Thirumalai Naicker College,
Pasumalai, Madurai.
Internal Examiner External Examiner
[Link] Date Name of the Program Page No. Signature
1 04-07-2025 The Largest Of Three Numbers 1
2 11-07-2025 Odd or Even 3
3 11-07-2025 Arithmetic Operations 5
4 18-07-2025 Display Numbers Form List 7
5 04-08-2025 Sum and Average 9
6 04-08-2025 Multiplication Table 11
7 11-08-2025 Factorial of Number 13
8 20-08-2025 Basics of R-Programming 15
9 29-08-2025 If-else statements in R 19
10 29-08-2025 For loop in R 21
11 09-09-2025 While loop in R 23
12 17-09-2025 Fibonacci series 25
13 17-09-2025 Vectors 27
14 26-09-2025 List 29
15 26-09-2025 Graphical presentation 33
[Link] :1 Date : 04-07-2025
THE LARGEST OF THREE NUMBERS
Aim:
To create the Largest Three Numbers using Python Programming.
Coding:
1
Output:
Result:
Thus, the Program Output was Successfully Executed.
2
[Link] :2 Date : 11-07-2025
ODD OR EVEN
Aim:
To create the Odd or Even Using Two Number in Python Programming.
Coding:
3
Output:
Result:
Thus, the Program Output was Successfully Executed.
4
[Link] :3 Date : 11-07-2025
ARITHMETIC OPERATIONS
Aim:
To create the Arithmetic Operations using Python Programming.
Coding:
5
Output:
Result:
Thus, the Program Output was Successfully Executed.
6
[Link] :4 Date : 18-07-2025
DISPLAY NUMBERS FORM LIST
Aim:
To create Display Numbers from List in Python Programming.
Coding:
7
Output:
Result:
Thus, the Program Output was Successfully Executed.
8
[Link] :5 Date : 04-08-2025
SUM AND AVERAGE
Aim:
To create the Numbers using Sum and Average in Python
Programming.
Coding:
9
Output:
Result:
Thus, the Program Output was Successfully Executed.
10
[Link] :6 Date : 04-08-2025
MULTIPLICATION TABLE
Aim:
To write a python program for multiplication table
Coding:
given_number=5
for i in range(11):
print(given_number,"x",i,"=",5*i)
11
Output:
5x0=0
5x1=5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
Result:
Thus the above program is executed successfully
12
[Link] :7 Date : 11-08-2025
FACTORIAL OF NUMBER
Aim:
To write a python program using for loop to calculated factorial of a number.
Coding:
num=int(input("enter the number:")
if (num==0)
fact=1
fact=1
for i in range (1,num+!):
fact=fact*i
print("factorial of",num"is",fact)
13
Output:
Enter the number: 4
Factorial of 4 is 24
Result:
Thus the above program is executed successfully
14
[Link]. 8 Date: 20-08-2025
Basics of R-Programming - Data types, Operators
Aim:
To perform basics of R-Programming.
Coding:
1. Data types:
1.1 Numeric datatype:
x = 45.6
class(x)
1.1 Output:
1.2 Integer datatype:
e = [Link](3)
class(e)
1.2 Output:
1.3 Character Data Type:
str1 = "Sam"
class(str1)
1.3 Output:
15
Use the [Link]() function to convert objects into character
values.
x = [Link](55.7)
print(x)
Output:
1.4 Logical Data Type:
x=3
y=5
a=x>y
1.4 Output:
2. Operators:
2.1 Addition operator (+):
a <- 28
b <- 8
print (a+b)
2.1 Output:
16
2.2 Subtraction Operator (-):
a <- 6
b <- 8.4
print (a-b)
2.2 Output:
2.3 Multiplication Operator (*):
B= c(4,4)
C= c(5,5)
print (B*C)
2.3 Output :
2.4 Division Operator (/):
a <- 10
b <- 5
print (a/b)
2.4 Output:
17
2.5 Power Operator (^):
a <- 4
b <- 5
print(a^b)
2.5 Output:
2.6 Modulo Operator (%%):
list1<- c(2, 22)
list2<-c(2,4)
print(list1 %% list2)
2.6 Output:
Result:
Thus the above program is executed successfully
18
[Link].9 Date: 29-08-2025
Making operations on if-else statements in R
Aim:
To implement if-else Statement in R programming.
Coding:
num = [Link](readline(prompt="Enter a number: "))
if(num > 0)
{
print("Positive number")
} else {
if(num == 0) {
print("Zero")
} else {
print("Negative number")
}
}
19
Output 1:
Output 2:
Result:
Thus the above program is executed successfully
20
Ex. No. 10 Date: 29-08-2025
Creating programs on for loop in R
Aim:
To implement for loop using R programming.
Coding:
num = readline(prompt="Enter a number: ");
num = [Link](num);
factorial = 1
if(num < 0) {
print("Sorry, factorial does not exist for negative numbers")
} else if(num == 0)
{
print("The factorial of 0 is 1")
} else {
for(i in 1:num) {
factorial = factorial * i
}
print(factorial)
}
21
Output:
Result:
Thus the above program is executed successfully
22
Ex. No. 11 Date: 09-09-2025
Creating programs on While loop in R
Aim:
To implement While loop in R programming.
Coding:
num = [Link](readline(prompt="Enter a number: "))
sum = 0
temp = num
while(temp > 0) {
digit = temp %% 10
sum = sum + (digit ^ 3)
temp = floor(temp / 10)
}
if(num == sum) {
print(paste(num, "is an Armstrong number"))
} else {
print(paste(num, "is not an Armstrong number"))
}
23
Output:
Result:
Thus the above program is executed successfully
24
Ex. No. 12 Date: 17-09-2025
Jp;l l’l
R program to calculate a Fibonacci series
Aim:
To write a R program to display Fibonacci Series.
Coding:
total_terms = [Link](readline(prompt="How many terms? "))
num1 = 0
num2 = 1
count = 2
if (total_terms <= 0) {
print("Please enter a positive integer")
} else {
if (total_terms == 1) {
print("Fibonacci sequence:")
print(num1)
} else {
print("Fibonacci sequence:")
print(num1)
print(num2)
while (count < total_terms ) {
nxt = num1 + num2
print(nxt)
num1 = num2
num2 = nxt
count = count + 1
}
}
}
25
Output:
Result:
Thus the above program is executed successfully
26
Ex. No. 13 Date: 17-09-2025
Vectors
Aim:
To implement vectors in R programming.
Coding:
Vector of strings:
fruits <- c("banana", "apple", "orange")
fruits
Output:
Vector of numerical values:
numbers <- c(1, 2, 3)
numbers
Output:
Vector with numerical values in a sequence
numbers <- 1:10
numbers
Output:
27
Vectors Sorting:
fruits <- c("banana", "apple", "orange", "mango", "lemon")
numbers <- c(13, 3, 5, 7, 20, 2)
sort(fruits)
sort(numbers)
Output:
Access Vectors:
fruits <- c("banana", "apple", "orange")
fruits[1]
Output:
Result:
Thus the above program is executed successfully
28
Ex. No. 14 Date: 26-09-2025
List
Aim:
To implement list in R programming.
Coding:
List of strings:
thislist <- list("apple", "banana", "cherry")
thislist
Output:
Access Lists:
thislist <- list("apple", "banana", "cherry")
thislist[1]
Output:
29
Change Item Value:
thislist <- list("apple", "banana", "cherry")
thislist[1] <- "blackcurrant"
thislist
Output:
List Length:
thislist <- list("apple", "banana", "cherry")
length(thislist)
Output:
Check if Item Exists:
Check if "apple" is present in the list:
thislist <- list("apple", "banana", "cherry")
"apple" %in% thislist
Output:
30
Add List Items:
Add "orange" to the list:
thislist <- list("apple", "banana", "cherry")
append(thislist, "orange")
Output:
Remove List Items:
Remove "apple" from the list:
thislist <- list("apple", "banana", "cherry")
newlist <- thislist[-1]
Output:
31
Range of Indexes:
Return the second, third, fourth and fifth item:
thislist <- list("apple", "banana", "cherry", "orange", "kiwi",
"melon", "mango")
(thislist)[2:5]
Output:
Result:
Thus the above program is executed successfully
32
Ex. No. 15 Date: 26-09-2025
Graphical presentation
Aim:
To create graphical presentation in R programming.
Coding:
x <- c(10,20,30,40)
# Create a vector of labels
mylabel <- c("Apples", "Bananas", "Cherries", "Dates")
# Display the pie chart with labels
pie(x, label = mylabel, main = "Fruits")
33
Output:
Result:
Thus the above program is executed successfully
34