Coding For C & IoT
Exam paper Analysis
PDF Comparator & Search Tool
Problem Solving C
1 TO 15
Academic Session(2024-2025)
(Even Semester)
Lab Course name PROGRAMMING FOR PROBLEM SOLVING LAB
Lab Course code PCS 101
Semester II
Academic year 2024-2025
Student Name
Program name B.Tech CSE
School UIT
COURSE INCHARGE Mr.Sukesh Kumar Bhagat
UNIVERSITY ROLL NO
SEMESTER 2nd (Event)
S.N Name of the experiment Page.no Date Signature
1. Write a Program to display the “Hello” word.
2. Write a program to calculate the area of Rectangle using user’s input.
3. Write a program to check weather a given number is even or odd.
4. Write a program to find the largest of three numbers using nested if else.
5. Write a program to find whether the given number is Armstrong or not.
6. Write a program to construct a Fibonacci series up to n terms.
7 Write a program to check weather a given number is prime or not.
8 Write a program to print the different pattern.
9 Write a program to sum of the elements of array.
10. Write a program to demonstrate the string functions.
11. Write a program for addition of two matrix.
12. Write a program to find the transpose of a given matrix & check whether it is symmetric or not
13. Write a program to calculate the factorial for given number using recursive function.
14. Write a program printing the elements of structure array using pointers
15. Write a program to open text file
EXPERIMENT NO.: 1
Title of Experiment: Write a Program to display the “Hello” word.
Program: B.Tech CSE Course: PROGRAMMING FOR PROBLEM SOLVING LAB
Course Code: PCS 101(L) Semester: II
Page no: ¼
#include <stdio.h>
int main() {
printf("Hello\n"); // Prints "Hello" to the console
return 0; // Indicates that the program executed successfully
}
gcc hello.c -o hello
./hello
Output:
EXPERIMENT NO.: 2
Title of Experiment: Write a program to calculate the area of Rectangle using user’s input.
Program: B.Tech CSE Course: PROGRAMMING FOR PROBLEM SOLVING LAB
Course Code: PCS 101(L) Semester: II
Page no: ¼
#include <stdio.h>
int main() {
float length, width, area;
// Prompt user for input
printf("Enter the length of the rectangle: ");
scanf("%f", &length); // Read the length from user
printf("Enter the width of the rectangle: ");
scanf("%f", &width); // Read the width from user
// Calculate area
area = length * width;
// Display the result
printf("The area of the rectangle is: %.2f\n", area);
return 0;
}
Output:
EXPERIMENT NO.: 3
Title of Experiment: Write a program to check weather a given number is even or odd.
Program: B.Tech CSE Course: PROGRAMMING FOR PROBLEM SOLVING LAB
Course Code: PCS 101(L) Semester: II
Page no: ¼
#include <stdio.h>
int main() {
int number;
// Prompt user for input
printf("Enter an integer: ");
scanf("%d", &number);
// Check if the number is even or odd
if (number % 2 == 0) {
printf("%d is an even number.\n", number);
} else {
printf("%d is an odd number.\n", number);
}
return 0;
}
Output:
EXPERIMENT NO.: 4
Title of Experiment: Write a program to find the largest of three numbers using nested if else.
Program: B.Tech CSE Course: PROGRAMMING FOR PROBLEM SOLVING LAB
Course Code: PCS 101(L) Semester: II
Page no: ¼
#include <stdio.h>
int main() {
int num1, num2, num3;
// Prompt user for input
printf("Enter three numbers:\n");
scanf("%d %d %d", &num1, &num2, &num3);
// Nested if-else to find the largest number
if (num1 >= num2) {
if (num1 >= num3) {
printf("The largest number is: %d\n", num1);
} else {
printf("The largest number is: %d\n", num3);
}
} else {
if (num2 >= num3) {
printf("The largest number is: %d\n", num2);
} else {
printf("The largest number is: %d\n", num3);
}
}
return 0;
}
Output:
EXPERIMENT NO.: 5
Title of Experiment: Write a program to find whether the given number is Armstrong or not.
Program: B.Tech CSE Course: Introduction to Python Programming Lab
Course Code: PCS 151(L) Semester: I
Page no: ¼
#include <stdio.h>
#include <math.h>
int main() {
int num, originalNum, remainder, result = 0, n = 0;
// Prompt user for input
printf("Enter an integer: ");
scanf("%d", &num);
originalNum = num;
// Find the number of digits in the number
while (originalNum != 0) {
originalNum /= 10;
n++;
}
originalNum = num;
// Calculate the sum of the digits raised to the power n
while (originalNum != 0) {
remainder = originalNum % 10;
result += pow(remainder, n);
originalNum /= 10;
}
// Check if the number is an Armstrong number
if (result == num) {
printf("%d is an Armstrong number.\n", num);
} else {
printf("%d is not an Armstrong number.\n", num);
}
return 0;
}
Output:
EXPERIMENT NO.: 6
Title of Experiment: Write a program to construct a Fibonacci series up to n terms.
Program: B.Tech CSE Course: Introduction to Python Programming Lab
Course Code: PCS 151(L) Semester: I
Page no: ¼
#include <stdio.h>
int main() {
int n, first = 0, second = 1, next, i;
// Prompt user for the number of terms
printf("Enter the number of terms: ");
scanf("%d", &n);
printf("Fibonacci Series up to %d terms:\n", n);
// Handle the special cases where n <= 0
if (n <= 0) {
printf("Please enter a positive integer.\n");
} else {
for (i = 1; i <= n; i++) {
if (i == 1) {
printf("%d ", first);
continue;
}
if (i == 2) {
printf("%d ", second);
continue;
}
next = first + second; // Calculate the next term
first = second; // Update the first term
second = next; // Update the second term
printf("%d ", next);
}
}
printf("\n");
return 0;
}
Output:
EXPERIMENT NO.: 7
Title of Experiment: Write a program to check weather a given number is prime or not.
Program: B.Tech CSE Course: Introduction to Python Programming Lab
Course Code: PCS 151(L) Semester: I
Page no: ¼
#include <stdio.h>
int main() {
int num, i, isPrime = 1;
// Prompt user for input
printf("Enter a positive integer: ");
scanf("%d", &num);
// Handle special cases
if (num <= 1) {
printf("%d is not a prime number.\n", num);
return 0;
}
// Check for factors other than 1 and itself
for (i = 2; i <= num / 2; i++) {
if (num % i == 0) {
isPrime = 0; // Number is not prime
break;
}
}
// Output the result
if (isPrime) {
printf("%d is a prime number.\n", num);
} else {
printf("%d is not a prime number.\n", num);
}
return 0;
}
Output:
EXPERIMENT NO.: 8
Title of Experiment: Write a program to print the different pattern.
Program: B.Tech CSE Course: Introduction to Python Programming Lab
Course Code: PCS 151(L) Semester: I
Page no: ¼
#include <stdio.h>
int main() {
int n, i, j;
// Prompt user for input
printf("Enter the number of rows for the pyramid: ");
scanf("%d", &n);
printf("Pyramid Pattern:\n");
// Outer loop for rows
for (i = 1; i <= n; i++) {
// Print spaces for alignment
for (j = 1; j <= n - i; j++) {
printf(" ");
}
// Print stars
for (j = 1; j <= (2 * i - 1); j++) {
printf("*");
}
printf("\n");
}
return 0;
}
Output:
*
***
*****
*******
*********
#include <stdio.h>
int main() {
int n, i, j;
// Prompt user for input
printf("Enter the number of rows for the triangle: ");
scanf("%d", &n);
printf("Right-Angled Triangle Pattern:\n");
// Outer loop for rows
for (i = 1; i <= n; i++) {
for (j = 1; j <= i; j++) {
printf("*");
}
printf("\n");
}
return 0;
}
Output:
*
**
***
****
*****
#include <stdio.h>
int main() {
int n, i, j;
// Prompt user for input
printf("Enter the number of rows for the inverted pyramid: ");
scanf("%d", &n);
printf("Inverted Pyramid Pattern:\n");
// Outer loop for rows
for (i = n; i >= 1; i--) {
for (j = 1; j <= n - i; j++) {
printf(" ");
}
for (j = 1; j <= (2 * i - 1); j++) {
printf("*");
}
printf("\n");
}
return 0;
}
Output:
*********
*******
*****
***
*
#include <stdio.h>
int main() {
int n, i, j;
// Prompt user for input
printf("Enter the number of rows for the diamond: ");
scanf("%d", &n);
printf("Diamond Shape Pattern:\n");
// Upper half of the diamond
for (i = 1; i <= n; i++) {
for (j = 1; j <= n - i; j++) {
printf(" ");
}
for (j = 1; j <= (2 * i - 1); j++) {
printf("*");
}
printf("\n");
}
// Lower half of the diamond
for (i = n - 1; i >= 1; i--) {
for (j = 1; j <= n - i; j++) {
printf(" ");
}
for (j = 1; j <= (2 * i - 1); j++) {
printf("*");
}
printf("\n");
}
return 0;
}
Output:
*
***
*****
*******
*********
*******
*****
***
*
#include <stdio.h>
int main() {
int n, i, j, coeff;
// Prompt user for input
printf("Enter the number of rows for Pascal's Triangle: ");
scanf("%d", &n);
printf("Pascal's Triangle:\n");
for (i = 0; i < n; i++) {
// Print leading spaces
for (j = 1; j <= n - i; j++) {
printf(" ");
}
// Print coefficients
coeff = 1;
for (j = 0; j <= i; j++) {
printf("%d ", coeff);
coeff = coeff * (i - j) / (j + 1);
}
printf("\n");
}
return 0;
}
Output:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
EXPERIMENT NO.: 9
Title of Experiment: Write a program to sum of the elements of array.
Program: B.Tech CSE Course: Introduction to Python Programming Lab
Course Code: PCS 151(L) Semester: I
Page no: ¼
#include <stdio.h>
int main() {
int n, sum = 0;
// Prompt user for the number of elements in the array
printf("Enter the number of elements in the array: ");
scanf("%d", &n);
int arr[n]; // Declare an array of size 'n'
// Input elements in the array
printf("Enter %d elements:\n", n);
for (int i = 0; i < n; i++) {
scanf("%d", &arr[i]);
}
// Calculate the sum of array elements
for (int i = 0; i < n; i++) {
sum += arr[i];
}
// Output the sum
printf("The sum of the elements in the array is: %d\n", sum);
return 0;
}
Output:
EXPERIMENT NO.: 10
Title of Experiment: Write a program to demonstrate the string functions.
Program: B.Tech CSE Course: Introduction to Python Programming Lab
Course Code: PCS 151(L) Semester: I
Page no: ¼
#include <stdio.h>
#include <string.h>
int main() {
char str1[100], str2[100], str3[100];
int length;
// Input two strings
printf("Enter the first string: ");
gets(str1); // Input first string
printf("Enter the second string: ");
gets(str2); // Input second string
// 1. strlen() - Calculate the length of the string
length = strlen(str1);
printf("Length of the first string is: %d\n", length);
// 2. strcpy() - Copy contents of one string to another
strcpy(str3, str1);
printf("Copy of the first string is: %s\n", str3);
// 3. strcat() - Concatenate two strings
strcat(str1, str2);
printf("Concatenated string: %s\n", str1);
// 4. strcmp() - Compare two strings
if (strcmp(str1, str2) == 0)
printf("The two strings are equal.\n");
else
printf("The two strings are not equal.\n");
// 5. strchr() - Find the first occurrence of a character in a string
char ch = 'a';
char *ptr = strchr(str1, ch);
if (ptr != NULL)
printf("First occurrence of '%c' in the string is at position: %ld\n", ch, ptr - str1 + 1);
else
printf("Character '%c' not found in the string.\n", ch);
return 0;
}
Output:
EXPERIMENT NO.: 11
Title of Experiment: Write a program for addition of two matrix.
Program: B.Tech CSE Course: Introduction to Python Programming Lab
Course Code: PCS 151(L) Semester: I
Page no: ¼
#include <stdio.h>
int main() {
int m, n, i, j;
// Prompt user for matrix dimensions
printf("Enter the number of rows and columns of the matrices: ");
scanf("%d %d", &m, &n);
// Declare two matrices and a result matrix
int matrix1[m][n], matrix2[m][n], sum[m][n];
// Input elements for the first matrix
printf("Enter elements of the first matrix:\n");
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
printf("Element [%d][%d]: ", i + 1, j + 1);
scanf("%d", &matrix1[i][j]);
}
}
// Input elements for the second matrix
printf("Enter elements of the second matrix:\n");
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
printf("Element [%d][%d]: ", i + 1, j + 1);
scanf("%d", &matrix2[i][j]);
}
}
// Perform matrix addition
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
sum[i][j] = matrix1[i][j] + matrix2[i][j];
}
}
// Display the result
printf("\nSum of the two matrices:\n");
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
printf("%d ", sum[i][j]);
}
printf("\n");
}
return 0;
}
Output:
EXPERIMENT NO.: 12
Title of Experiment: Write a program to find the transpose of a given matrix & check whether it is symmetric or not
Program: B.Tech CSE Course: Introduction to Python Programming Lab
Course Code: PCS 151(L) Semester: I
Page no: ¼
#include <stdio.h>
int main() {
int m, n, i, j;
int symmetric = 1; // Flag to check symmetry
// Input matrix dimensions
printf("Enter the number of rows and columns of the matrix: ");
scanf("%d %d", &m, &n);
// Declare the matrix and its transpose
int matrix[m][n], transpose[n][m];
// Input matrix elements
printf("Enter elements of the matrix:\n");
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
printf("Element [%d][%d]: ", i + 1, j + 1);
scanf("%d", &matrix[i][j]);
}
}
// Calculate the transpose of the matrix
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
transpose[j][i] = matrix[i][j];
}
}
// Display the original matrix
printf("\nOriginal matrix:\n");
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
printf("%d ", matrix[i][j]);
}
printf("\n");
}
// Display the transpose of the matrix
printf("\nTranspose of the matrix:\n");
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
printf("%d ", transpose[i][j]);
}
printf("\n");
}
// Check if the matrix is square and symmetric
if (m == n) {
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
if (matrix[i][j] != transpose[i][j]) {
symmetric = 0;
break;
}
}
}
if (symmetric) {
printf("\nThe matrix is symmetric.\n");
} else {
printf("\nThe matrix is not symmetric.\n");
}
} else {
printf("\nThe matrix is not square, so it cannot be symmetric.\n");
}
return 0;
}
Output:
EXPERIMENT NO.: 13
Title of Experiment: Write a program to calculate the factorial for given number using recursive function.
Program: B.Tech CSE Course: Introduction to Python Programming Lab
Course Code: PCS 151(L) Semester: I
Page no: ¼
#include <stdio.h>
// Function to calculate factorial recursively
int factorial(int n) {
// Base case: factorial of 0 or 1 is 1
if (n == 0 || n == 1) {
return 1;
}
// Recursive case: factorial of n is n * factorial of (n-1)
else {
return n * factorial(n - 1);
}
}
int main() {
int num;
// Input: prompt user for the number
printf("Enter a number to calculate its factorial: ");
scanf("%d", &num);
// Check for negative input
if (num < 0) {
printf("Factorial is not defined for negative numbers.\n");
} else {
// Call the recursive function and display the result
printf("Factorial of %d is %d\n", num, factorial(num));
}
return 0;
}
Output:
EXPERIMENT NO.: 14
Title of Experiment: Write a program printing the elements of structure array using pointers.
Program: B.Tech CSE Course: Introduction to Python Programming Lab
Course Code: PCS 151(L) Semester: I
Page no: ¼
#include <stdio.h>
// Define a structure to store information
struct Student {
int roll_no;
char name[50];
float marks;
};
int main() {
int n;
// Input: number of students
printf("Enter the number of students: ");
scanf("%d", &n);
// Declare an array of structures
struct Student students[n];
// Input student details using structure array
for (int i = 0; i < n; i++) {
printf("\nEnter details for student %d:\n", i + 1);
printf("Roll Number: ");
scanf("%d", &students[i].roll_no);
printf("Name: ");
getchar(); // To consume newline character left by previous scanf
fgets(students[i].name, sizeof(students[i].name), stdin); // Read string with spaces
printf("Marks: ");
scanf("%f", &students[i].marks);
}
// Pointer to the structure array
struct Student *ptr = students;
// Print student details using pointer
printf("\nStudent Details:\n");
for (int i = 0; i < n; i++) {
printf("\nStudent %d:\n", i + 1);
printf("Roll Number: %d\n", (ptr + i)->roll_no);
printf("Name: %s", (ptr + i)->name); // fgets already includes the newline
printf("Marks: %.2f\n", (ptr + i)->marks);
}
return 0;
}
Output:
EXPERIMENT NO.: 15
Title of Experiment: Program to illustrate the concept of method overriding in python
Program: B.Tech CSE Course: Introduction to Python Programming Lab
Course Code: PCS 151(L) Semester: I
Page no: ¼
#include <stdio.h>
int main() {
FILE *file;
char data[100];
// Open the file in append mode
file = fopen("example.txt", "a");
// Check if the file was opened successfully
if (file == NULL) {
printf("Error opening the file.\n");
return 1;
}
// Input data to be appended
printf("Enter text to append to the file: ");
fgets(data, sizeof(data), stdin); // Read input including spaces
// Write data to the file
fprintf(file, "%s", data);
// Close the file
fclose(file);
printf("Data successfully appended to the file.\n");
return 0;
}
Output:
IOT
CurrencyConverter/
MainApp.java
converters/
CurrencyConverter.java
DistanceConverter.java
TimeConverter.java
CurrencyConverter.java:
package converters;
public class CurrencyConverter {
private static final double DOLLAR_TO_INR = 82.5;
private static final double EURO_TO_INR = 89.0;
private static final double YEN_TO_INR = 0.61;
public static double convertDollarToINR(double dollar) {
return dollar * DOLLAR_TO_INR;
}
public static double convertINRToDollar(double inr) {
return inr / DOLLAR_TO_INR;
}
public static double convertEuroToINR(double euro) {
return euro * EURO_TO_INR;
}
public static double convertINRToEuro(double inr) {
return inr / EURO_TO_INR;
}
public static double convertYenToINR(double yen) {
return yen * YEN_TO_INR;
}
public static double convertINRToYen(double inr) {
return inr / YEN_TO_INR;
}
}
DistanceConverter.java:
package converters;
public class DistanceConverter {
private static final double METER_TO_KM = 0.001;
private static final double MILES_TO_KM = 1.60934;
public static double convertMeterToKM(double meter) {
return meter * METER_TO_KM;
}
public static double convertKMToMeter(double km) {
return km / METER_TO_KM;
}
public static double convertMilesToKM(double miles) {
return miles * MILES_TO_KM;
}
public static double convertKMToMiles(double km) {
return km / MILES_TO_KM;
}
}
TimeConverter.java:
package converters;
public class TimeConverter {
public static int convertHoursToMinutes(int hours) {
return hours * 60;
}
public static int convertHoursToSeconds(int hours) {
return hours * 3600;
}
public static double convertMinutesToHours(int minutes) {
return minutes / 60.0;
}
public static double convertSecondsToHours(int seconds) {
return seconds / 3600.0;
}
}
MainApp.java:
import converters.CurrencyConverter;
import converters.DistanceConverter;
import converters.TimeConverter;
import java.util.Scanner;
public class MainApp {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int choice;
do {
System.out.println("=== Converter Application ===");
System.out.println("1. Currency Converter");
System.out.println("2. Distance Converter");
System.out.println("3. Time Converter");
System.out.println("4. Exit");
System.out.print("Enter your choice: ");
choice = scanner.nextInt();
switch (choice) {
case 1:
System.out.println("Currency Converter:");
System.out.println("1. Dollar to INR");
System.out.println("2. INR to Dollar");
System.out.println("3. Euro to INR");
System.out.println("4. INR to Euro");
System.out.println("5. Yen to INR");
System.out.println("6. INR to Yen");
System.out.print("Enter your option: ");
int currencyChoice = scanner.nextInt();
System.out.print("Enter the amount: ");
double amount = scanner.nextDouble();
switch (currencyChoice) {
case 1 -> System.out.println("Result: " + CurrencyConverter.convertDollarToINR(amount) + " INR");
case 2 -> System.out.println("Result: " + CurrencyConverter.convertINRToDollar(amount) + " USD");
case 3 -> System.out.println("Result: " + CurrencyConverter.convertEuroToINR(amount) + " INR");
case 4 -> System.out.println("Result: " + CurrencyConverter.convertINRToEuro(amount) + " EUR");
case 5 -> System.out.println("Result: " + CurrencyConverter.convertYenToINR(amount) + " INR");
case 6 -> System.out.println("Result: " + CurrencyConverter.convertINRToYen(amount) + " YEN");
default -> System.out.println("Invalid option.");
}
break;
case 2:
System.out.println("Distance Converter:");
System.out.println("1. Meter to KM");
System.out.println("2. KM to Meter");
System.out.println("3. Miles to KM");
System.out.println("4. KM to Miles");
System.out.print("Enter your option: ");
int distanceChoice = scanner.nextInt();
System.out.print("Enter the distance: ");
double distance = scanner.nextDouble();
switch (distanceChoice) {
case 1 -> System.out.println("Result: " + DistanceConverter.convertMeterToKM(distance) + " KM");
case 2 -> System.out.println("Result: " + DistanceConverter.convertKMToMeter(distance) + " Meter");
case 3 -> System.out.println("Result: " + DistanceConverter.convertMilesToKM(distance) + " KM");
case 4 -> System.out.println("Result: " + DistanceConverter.convertKMToMiles(distance) + " Miles");
default -> System.out.println("Invalid option.");
}
break;
case 3:
System.out.println("Time Converter:");
System.out.println("1. Hours to Minutes");
System.out.println("2. Hours to Seconds");
System.out.println("3. Minutes to Hours");
System.out.println("4. Seconds to Hours");
System.out.print("Enter your option: ");
int timeChoice = scanner.nextInt();
System.out.print("Enter the time: ");
int time = scanner.nextInt();
switch (timeChoice) {
case 1 -> System.out.println("Result: " + TimeConverter.convertHoursToMinutes(time) + " Minutes");
case 2 -> System.out.println("Result: " + TimeConverter.convertHoursToSeconds(time) + " Seconds");
case 3 -> System.out.println("Result: " + TimeConverter.convertMinutesToHours(time) + " Hours");
case 4 -> System.out.println("Result: " + TimeConverter.convertSecondsToHours(time) + " Hours");
default -> System.out.println("Invalid option.");
}
break;
case 4:
System.out.println("Exiting the application.");
break;
default:
System.out.println("Invalid choice. Try
again.");
}
} while (choice != 4);
scanner.close();
}
}
How to Compile and Run:
Compile:
javac -d . MainApp.java converters/*.java
Run
java MainApp
import pandas as pd
# Load dataset (replace 'your_dataset.csv' with your file)
df = pd.read_csv("C:/Users/Administrator/Desktop/cars.csv")
print("\n First 5 rows of dataset:")
print(df.head())
# =====================================
# 1. Check basic info
# =====================================
print("\n Dataset Info:")
print(df.info())
print("\n Missing values in each column:")
print(df.isnull().sum())
# =====================================
# 2. Handle missing values
# =====================================
# Option A: Drop rows with missing values
df_cleaned = df.dropna()
# Option B: Fill missing values (example: numerical with mean, categorical with mode)
for col in df.columns:
if df[col].dtype == "object": # categorical
df[col].fillna(df[col].mode()[0], inplace=True)
else: # numerical
df[col].fillna(df[col].mean(), inplace=True)
# =====================================
# 3. Remove duplicates
# =====================================
df.drop_duplicates(inplace=True)
# =====================================
# 4. Handle inconsistent text formatting (strip spaces, lowercase)
# =====================================
for col in df.select_dtypes(include=["object"]).columns:
df[col] = df[col].str.strip().str.lower()
# =====================================
# 5. Handle outliers: remove rows beyond 3 std dev for numeric columns
# =====================================
for col in df.select_dtypes(include=["int64", "float64"]).columns:
mean = df[col].mean()
std = df[col].std()
df = df[(df[col] >= mean - 3*std) & (df[col] <= mean + 3*std)]
# =====================================
# 6. Save cleaned dataset
# =====================================
df.to_csv("cleaned_dataset.csv", index=False)
print("\n Dataset cleaned and saved as 'cleaned_dataset.csv'")


Comments
Post a Comment