Computer Science (083)
Lab file
Session-2024-25
Submitted to: Submitted By:
Sonam Agarwal Divya Yadav
Class: XII – C
Index
S. Program
No.
1. Input to swap two numbers
2. Input to reversed two-digit number
3. Input to reversed three-digit number
4. Input to classify odd and even numbers
5. Input to classify positive and negative numbers, and zero
6. Input to take out largest number from 3 numbers
7. Input to classify uppercase/ lowercase/ digit/ special character
8. Input to take out natural numbers up to n
9. Input to take out multiples of b till n
10. Input to take out sum of natural numbers till n
11. Input to upper and lower triangle pattern
12. Input to take out natural numbers from n to 100
13. Input to take out sum of natural numbers from n till 100
14. Input for factorial of a number
15. Input to take out sum of even and odd numbers of first n natural numbers
16. Input to reverse number using for- and while-loop
17. Input to make number pattern
18. Input to make alphabet patterns with repetition
19. Input to make alphabet pattern
20. Input to make pyramid pattern
21. Number pyramid
22. Number pattern without repetition
23. Classify prime numbers
24. Split 6-digit number into three 2-digit numbers
25. Check for a perfect number
26. Check for Armstrong number
27. Palindrome number
28. Fibonacci numbers
29. HCF and LCM of two numbers
30. Arithmetic operations
31. Palindrome string
32. Number of uppercase and lowercase letters, alphabets, digits and symbols in a line
33. Occurrences of substring in a given string
34. Print words along with number of letters in each, from a line
35. Print words and their total number from a line
36. Location of character in string
37. Mean of a list
38. Maximum value from 2 lists
39. Split an integral list into positive and negative lists
40. Remove duplicate elements from a list
41. Second-largest element in tuple
42. Calculate area of different shape
43. two numbers and returns the result of all arithmetic operations on these numbers.
44. calculate simple interest using a function interest() that can receive principal amount, time
and rate and
returns calculated simple interest. Do specify default values for rate and time as 10% and 2
years respectively.
45. Read a text file line by line and display each word separated by a #.
46. Display the size of fie is bytes
47. Create a file that hold some data
48. .Function in oython that counts the no. of ‘me’ or ‘my’ words that present of in a text file
49. Program to get student data, roll no., name and marks from a user and get onto a binary file.
50. Create a csv file roll no., name, marks obtained data from user and write into the file
51. program that defines and calls the following user defined function:
add()-> to accept and add data of an employee to a csv file ‘record.csv’. Each record consist
of a
list with field elements as empid, name and mobile to store employee id , employee name
and employee salary respectively.
Counter()->to count the number of records present in the csv file named ‘record.csv’.
52. A program to implement the stack operation (push and pop)
Program-1
Write a program to reverse of three numbers
OUTPUT
1. INPUT
OUTPUT
2. INPUT
OUTPUT
3. INPUT
OUTPUT
4. INPUT
OUTPUT
5. INPUT
OUTPUT
6. INPUT
OUTPUT
7. INPUT
OUTPUT
8. INPUT
OUTPUT
9. INPUT
OUTPUT
10. INPUT
OUTPUT
11. INPUT
OUTPUT
12. INPUT
OUTPUT
13. INPUT
OUTPUT
14. INPUT
OUTPUT
15. INPUT
OUTPUT
16. INPUT
OUTPUT
17. INPUT
OUTPUT
18. INPUT
OUTPUT
19. INPUT
OUTPUT
20. INPUT
OUTPUT
21. INPUT
OUTPUT
22. INPUT
OUTPUT
23. INPUT
OUTPUT
24. INPUT
OUTPUT
25. INPUT
OUTPUT
26. INPUT
OUTPUT
27. INPUT
OUTPUT
28. INPUT
OUTPUT
29. INPUT
OUTPUT
30. INPUT
OUTPUT
31. INPUT
OUTPUT
32. INPUT
OUTPUT
33. INPUT
OUTPUT
34. INPUT
OUTPUT
35. INPUT
OUTPUT
36. INPUT
OUTPUT
37. INPUT
OUTPUT
38. INPUT
OUTPUT
42. Calculate area of different shape
Input
Output
43.
two numbers and returns the result of all arithmetic operations on these numbers.
Input
Output
44. calculate simple interest using a function interest() that can receive principal amount, time
and rate and returns calculated simple interest. Do specify default values for rate and time as
10% and 2 years respectively.
Input
Output
45.Read a text file line by line and display each word separated by a #.
input
Output
46.Display the size of fie is bytes
input
Output
47.Create a file that hold some data
Input
Output
48.Function in oython that counts the no. of ‘me’ or ‘my’ words that present of in a text file
(story.txt)
Input
Output
49.Program to get student data, roll no., name and marks from a user and get onto a binary
file.
Input
Output
50.Create a csv file roll no., name, marks obtained data from user and write into the file
Input
Output
51. program that defines and calls the following user defined function:
add()-> to accept and add data of an employee to a csv file ‘record.csv’. Each record consist
of a list with field elements as empid, name and mobile to store employee id , employee
name and employee salary respectively.
Counter()->to count the number of records present in the csv file named ‘record.csv’.
input
Output
52.A program to implement the stack operation (push and pop)
INPUT
OUPUT
53. TABLE: PRODUCT
P_ID NAME UPrice Rating BID
P01 Shampoo 120 6 M03
P02 Toothpaste 54 8 M02
P03 Soap 25 7 M03
P04 Toothpaste 64 4 M04
P05 Soap 38 5 M05
PO6 Shampoo 245 6 M05
TABLE: BRAND
BID BRAND
M02 Dant Kanti
M03 Medimix
M04 Pepsodent
M05 Dove
a) Display product name and brand name from the tables PRODUCT and BRAND.
b) Display the structure of the table product.
c) Display the average rating of Medimix and Dove brands.
d) Display the name, price, and rating of the products in descending order.