0% found this document useful (0 votes)
52 views63 pages

Class 11-CS-Practical File-Vivaan Garg

Uploaded by

vivaangarg0516
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)
52 views63 pages

Class 11-CS-Practical File-Vivaan Garg

Uploaded by

vivaangarg0516
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/ 63

VASANT VALLEY SCHOOL

Session 2023-24

PROGRAM FILE

Made By
Name: Vivaan Garg
Class: 11A
Elective: E2

ACKNOWLEDGEMENT
Completing this computer science assignment has been a fantastic
learning journey for me. I've not only gained knowledge but also
grown as a person during this process. I want to express my
heartfelt
thanks to my computer science teacher, Ms. Harmeet Kaur, for her
unwavering support and excellent guidance. Her help has been crucial
in my progress. This project introduced me to new perspectives,
improved my understanding of the subject, and made me a better
problem solver. I'm truly grateful for this enlightening experience and
I'm excited about how the knowledge I've gained will positively
impact my future adventures in the fascinating world of computer
science.2

CERTIFICATE
This is to certify that ___________________________, student
of class XI has successfully completed these practical under the
guidance of Ms. Harmeet Kaur during the academic year 2023-
24 in partial fulfilment of computer practical examination
requirement for year-end examination.

Signature of Computer teacher: _______________________

Date: ________________________

INDEX
SN DATE PAGE
PROBLEM STATEMENT NO.
O.

1. Area of a Rectangle 10th August, 2023 5

2. Temperature Conversion 10th August, 2023 6

3. Height Conversion 10th August, 2023 7

4. Metric Converter 10th August, 2023 8

5. Simple Interest Calculation 10th August, 2023 9


6. Body Mass Index (BMI) Calculator 10th August, 2023 10

7. Quadratic Equation Solver 10th August, 2023 11

8. Fahrenheit to Celsius Conversion 10th August, 2023 12

9. Find if number negative or positive or 20th August, 2023 13

zero 10. Even-Odd determiner 20th August, 2023 14

11. Find Leap Year 20th August, 2023 15

12 .Grade Calculator 20th August, 2023 16

13. Type of triangle 20th August, 2023 17

14. Find Largest number 20th August, 2023 18

15. Vowel or Consonant 20th August, 2023 19

16. Cartesian Coordinate 20th August, 2023 20

17. Discount price 20th August, 2023 21

18. Divisibility of number 20th August, 2023 22

19. Type of triangle on angle 20th August, 2023 23

20. Area of Triangle 20th August, 2023 24

21. Day of week 20th August, 2023 25

22. Century year 20th August, 2023 26


23. Largest in four 20th August, 2023 27

24. Perfect Square 20th August, 2023 28

25. Largest in four 20th August, 2023 29

26. Inside/Outside Circle 20th August, 2023 30

27. Tax Calculator 20th August, 2023 31

28. Vowels in a string 21st September, 2023 32

29. Email id manipulation using tuples 21st September, 2023 33

30. Storing students’ names in a tuple 21st September, 2023 34

31. Number into words 21st September, 2023 35

32. Create Dictionary from string 21st September, 2023 36

33. Student details in dictionary 21st September, 2023 37

34. Telephone dictionary 21st September, 2023 38

35. ‘Teleback Dictionary’ 21st September, 2023 39

36. Friend details in dictionary 27th October, 2023 40

37. Menu driven bank 27th October, 2023 41

38. Occurrences in a list 27th October, 2023 42

39. Positive/negative numbers in a list 27th October, 2023 43

40. Largest element in list 27th October, 2023 44

41. The second largest element in a list 27th October, 2023 45

42. Median in a list 27th October, 2023 46

43. Remove duplicates 27th October, 2023 47

44. List modification 27th October, 2023 48

45. Delete list element 27th October, 2023 49

46. List reversal 27th October, 2023 50

47. Sorting list 27th October, 2023 51


48. Vowels in a string 27th October, 2023 52

49. Replace blank space with hyphen 27th October, 2023 53

50. Length of string 27th October, 2023 54

51. Number of words/characters in 27th October, 2023 55

string 52. Larger of two strings 12th December, 2023 56

53. Number of lowercase characters 12th December, 2023 57

54. Palindrome checker 12th December, 2023 58

55. Calculate upper/lower case letters 12th December, 2023 59

together 56. Number of digits and letters in 12th December, 2023 60

string 57. Create new string 12th December, 2023 61

58. Word occurrences 12th December, 2023 62

59. Check for substring 12th December, 2023 63

60. First occurrence of a character 27th December, 2023 64

61. Find ASCII Value 27th December, 2023 65

62. Remove last occurrence 27th December, 2023 66

Case Studies:-

1. Bank interface 2nd January, 2024 67-72

2. Quiz Game 2nd January, 2024 73-79

2nd January, 2024 80-85


3. Heritage sites in India
2nd January, 2024 86-91
4. Transport Automation

The practical file starts from the


following page
PROGRAM #1
PROBLEM STATEMENT:
Write a Python program to calculate and display the area of a rectangle.
Prompt the user to enter the length and width of the rectangle as
floating-point numbers.

PROGRAM CODE:

OUTPUT (ALL OPTIONS):

PROGRAM #2
PROBLEM STATEMENT:
Write a Python program to convert temperature from Celsius to Fahrenheit.
Prompt the user to enter the temperature in Celsius as a floating-point number
and display the corresponding temperature in Fahrenheit.

PROGRAM CODE:
OUTPUT (ALL OPTIONS):

PROGRAM #3
PROBLEM STATEMENT:
Write a Python program to convert height from feet and inches to centimetres.
Prompt the user to enter the height in feet and the remaining height in inches
as integers. Display the height in centimetres as a floating-point number.

PROGRAM CODE:

OUTPUT (ALL OPTIONS):

PROGRAM #4
PROBLEM STATEMENT:
Write a Python program to convert distance from kilometres to miles and
volume from litters to gallons. Prompt the user to enter the distance in
kilometres and volume in litters as floating-point numbers. Display the
corresponding distance in miles and volume in gallons.

PROGRAM CODE:
OUTPUT (ALL OPTIONS):

PROGRAM #5
PROBLEM STATEMENT:
Write a Python program to calculate the simple interest for a given principal
amount, rate of interest, and time period. Prompt the user to enter the
principal amount, rate of interest (as a percentage), and time period (in years)
as floating-point numbers. Display the simple interest as a floating-point
number.

PROGRAM CODE:

OUTPUT (ALL OPTIONS):

PROGRAM #6
PROBLEM STATEMENT:
Write a Python program to calculate the Body Mass Index (BMI) for a person based on
their weight and height. Prompt the user to enter their weight in kilograms and height in
meters as floating-point numbers. Calculate the BMI using the formula: BMI = weight /
(height * height) and display the result as a floating-point number.

PROGRAM CODE:

OUTPUT (ALL OPTIONS):

10

PROGRAM #7
PROBLEM STATEMENT:
Write a Python program to solve a quadratic equation of the form ax^2 + bx + c = 0.
Prompt the user to enter the values of coefficients a, b, and c as floating-point numbers.
Display the solutions of the equation (real and imaginary, if any) in a readable format.

PROGRAM CODE:
OUTPUT (ALL OPTIONS):

11

PROGRAM #8
PROBLEM STATEMENT:
Write a Python program to convert temperature from Fahrenheit to Celsius. Prompt the
user to enter the temperature in Fahrenheit as a floating-point number and display the
corresponding temperature in Celsius.

PROGRAM CODE:

OUTPUT (ALL OPTIONS):

12

PROGRAM #9
PROBLEM STATEMENT:
Write a Python program to check if a given number is positive, negative, or zero.

. PROGRAM CODE:

OUTPUT (ALL OPTIONS):

13

PROGRAM #10
PROBLEM STATEMENT:
Write a Python program to determine if a given number is even or odd.

PROGRAM CODE:
OUTPUT (ALL OPTIONS):

14

PROGRAM #11
PROBLEM STATEMENT:
Write a Python program to check if a year is a leap year or not.

PROGRAM CODE:
OUTPUT (ALL OPTIONS):

15

PROGRAM #12
PROBLEM STATEMENT:
Write a Python program to calculate the grade based on a student's score (e.g., A, B, C, D,
F).

PROGRAM CODE:
OUTPUT (ALL OPTIONS):

16

PROGRAM #13
PROBLEM STATEMENT:
Write a Python program to check if a triangle is equilateral, isosceles, or scalene based on
side lengths.

PROGRAM CODE:

OUTPUT (ALL OPTIONS):


17
PROGRAM #14
PROBLEM STATEMENT:
Write a Python program to determine the largest among three given numbers.

PROGRAM CODE:

OUTPUT (ALL OPTIONS):

18
PROGRAM #15
PROBLEM STATEMENT:
Write a Python program to check if a character is a vowel or a consonant.

PROGRAM CODE:

OUTPUT

(ALL OPTIONS):
19

PRO
GRAM #16
PROBLEM STATEMENT:
Write a Python program to determine the quadrant in which a given point lies in a
Cartesian coordinate system.

PROGRAM CODE:
OUTPUT (ALL OPTIONS):

20
PROGRAM #17
PROBLEM STATEMENT:
Write a Python program to calculate the discounted price of an item based on the
original price and discount percentage

.PROGRAM CODE:

21
OUTPUT (ALL OPTIONS):

PROGRAM #18
PROBLEM STATEMENT:
Write a Python program to check if a given number is divisible by both 5 and 7.
PROGRAM CODE:

22
OUTPUT (ALL OPTIONS):

PROGRAM #19
PROBLEM STATEMENT:
Write a Python program to determine the type of a triangle based on its angles (e.g.,
acute, obtuse, or right

PROGRAM CODE:

23
OUTPUT (ALL OPTIONS):

PROGRAM #20
PROBLEM STATEMENT:
Write a Python program to calculate the area of a triangle using the base and height
provided.

PROGRAM CODE:

OUTPUT (ALL OPTIONS):

PROGRAM #21
PROBLEM STATEMENT:
Write a Python program to determine the day of the week based on a given number (1 for Monday, 2 for
Tuesday, etc.).

PROGRAM CODE:
OUTPUT (ALL OPTIONS):

PROGRAM #22

PROBLEM STATEMENT:
Write a Python program to check if a given year is a century year (e.g., 1900, 2000,

2100). PROGRAM CODE:


OUTPUT (ALL OPTIONS):

PROGRAM #23
PROBLEM STATEMENT:
Write a Python program to determine the largest among four given numbers.

PROGRAM CODE:

OUTPUT (ALL OPTIONS):


PROGRAM #24
PROBLEM STATEMENT:
Write a Python program to check if a number is a perfect square (e.g., 4, 9, 16,

25). PROGRAM CODE:

OUTPUT (ALL OPTIONS):

PROGRAM #25
PROBLEM STATEMENT:
Write a Python program to determine the discount percentage based on the total purchase amount (e.g.,
10% off for $100 or more).

PROGRAM CODE:

OUTPUT (ALL OPTIONS):

PROGRAM #26
PROBLEM STATEMENT:

Write a Python program to check if a given point lies inside a circle with a given center and

radius. PROGRAM CODE:


OUTPUT (ALL OPTIONS):

PROGRAM #27
PROBLEM STATEMENT:
Write a Python program that calculates the income tax for an individual based on their annual salary. The
tax calculation should consider the following tax rate structure:
● Income up to $10,000: No tax
● Income from $10,001 to $30,000: 10% tax
● Income from $30,001 to $70,000: 20% tax
● Income above $70,000: 30% tax

PROGRAM CODE:
OUTPUT (ALL OPTIONS):

PROGRAM #28
Write a Program to Count the Number of Vowels in a String.

PROGRAM CODE AND OUTPUT:


PROGRAM #29
1. WAP to read email IDs of a number of students and store them in a tuple. Create two new tuples, one to
store only the usernames from the email IDs and second to store domain names from the email IDs.
Print all three tuples at the end of the program. [Hint: You may use the function split()]

PROGRAM CODE AND OUTPUT:

PROGRAM #30
1. WAP to input names of n students and store them in a tuple. Also, input a name from the user and find
if this student is present in the tuple or not.

PROGRAM CODE AND OUTPUT:


PROGRAM #31
1. WAP to convert a number entered by the user into its corresponding number in
words. For example, if the input is 876 then the output should be ‘Eight Seven Six’
d = {1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine'}

PROGRAM CODE AND OUTPUT:


PROGRAM #32
WAP to create a dictionary from a string.Track the count of the letters from the

string. PROGRAM CODE AND OUTPUT:


PROGRAM #33
WAP that keeps the student's name and his marks in a dictionary as key-value pairs. The program should
store records of 10 students and display students name and marks of 5 students in decreasing order of marks
obtained.

PROGRAM CODE AND OUTPUT:


PROGRAM #34
Given a dictionary TELEPHONE containing KEY:VALUE pairs of the following
elements. TELEPHONE { KEY: Name VALUE: (Address, AreaCode, phone_No) }

PROGRAM CODE AND OUTPUT:

PROGRAM #35
WAP, menu-driven to implement the following options
a. Copy all those records having AreaCode as “123” from TELEPHONE to TELEBACK dictionary. b.
Display contents of TELEPHONE dictionary. c. Delete a record from the TELEPHONE dictionary for an
AreaCode given by the user. d. Display contents of TELEBACK dictionary.

PROGRAM CODE AND OUTPUT:


PROGRAM #36
WAP to input your friends’ names and their Phone Numbers and store them in the dictionary as the key-
value pair.
Perform the following operations on the dictionary:
a) Display the name and phone number of all your friends
b) Add a new key-value pair in this dictionary and display the modified dictionary
c) Delete a particular friend from the dictionary
d) Modify the phone number of an existing friend
e) Check if a friend is present in the dictionary or not
f) Display the dictionary in sorted order of names

PROGRAM CODE AND OUTPUT:


PROGRAM #37
Given the following dictionary,
Bank = {101: ['JACK', 23000]}

WAP, menu-driven:
a) Add a new bank customer
b) Deposit money for specific customer c)
Withdraw money for a specific customer
d) Display all Bank Data
e) Display specific customer information

PROGRAM CODE AND

OUTPUT:
PROGRAM #38
WAP to find the number of times an element occurs in the list.
PROGRAM CODE AND OUTPUT:

PROGRAM #39
WAP to read a list of n integers. Create two new lists, one having all +VE numbers and the other having all -VE
numbers from the given list. Print all three lists.

PROGRAM CODE AND OUTPUT:


PROGRAM# 40
WAP that returns the largest element of the list passed as parameter.

PROGRAM CODE AND OUTPUT:


PROGRAM #41
WAP to return the second largest number from a list of numbers.

PROGRAM CODE AND OUTPUT:


PROGRAM #42
WAP to read a list of n integers and find their median.

PROGRAM CODE AND OUTPUT:


PROGRAM #43
WAP to read a list of elements. Modify this list so that it does not contain any duplicate elements.

PROGRAM CODE AND OUTPUT:


PROGRAM #44
WAP to read a list of elements. Input an element from the user that has to be inserted in the list. Also input the
position at which it is to be inserted. Write a user defined function to insert the element at the desired position
in the list.

PROGRAM CODE AND OUTPUT:


PROGRAM #45
WAP to read elements of a list.
a) Ask for the position of the element to be deleted from the list and delete it.
b) Ask for the value of the element to be deleted from the list and delete it.

PROGRAM CODE AND OUTPUT:


PROGRAM CODE AND OUTPUT:

PROGRAM #46
9. Read a list of n elements.WAP which reverses this list in-place without creating a new list.

PROGRAM CODE AND OUTPUT:


PROGRAM #47
WAP, menu driven to perform various list operations:
Append, Insert, Append a list to the given list, Modify an existing element, Delete an existing element from its
position or a given value, Sort the list in ascending order/ descending order, Display the list.

PROGRAM CODE AND OUTPUT:


PROGRAM #48
Write a Program to Count the Number of Vowels in a String.

PROGRAM CODE AND OUTPUT:


PROGRAM #49
Write a Program to Take in a String and Replace Every Blank Space with Hyphen.

PROGRAM CODE AND OUTPUT:


PROGRAM #50
Write a Program to Calculate the Length of a String Without Using a Library FunctIon.

PROGRAM CODE AND OUTPUT:

PROGRAM #51
Write a Program to Calculate the Number of Words and the Number of Characters Present a
String

PROGRAM CODE AND OUTPUT:


PROGRAM #52
Write a Program to Take in Two Strings and Display the Larger String without built in
Functions.

PROGRAM CODE AND OUTPUT:


PROGRAM #53
Write a Program to Count Number of Lowercase Characters in a String

PROGRAM CODE AND OUTPUT:


PROGRAM #54
Write a Program to Check if a String is a Palindrome or Not

PROGRAM CODE AND OUTPUT:


PROGRAM #55
Write a Program to Calculate the Number of Upper-Case Letters and Lowercase Letters in a
String

PROGRAM CODE AND OUTPUT:


PROGRAM #56
Write a Program to Calculate the Number of Digits and Letters in a String

PROGRAM CODE AND OUTPUT:


PROGRAM #57
Write a Program to Form a New String Made of the First 2 and Last 2 characters From a Given
String

PROGRAM CODE AND OUTPUT:


PROGRAM #58
Write a Program to Count the Occurrences of Each Word in a Given String Sentence.
PROGRAM CODE AND OUTPUT:

PROGRAM #59
Write a Program to Check if a Substring is Present in a Given String

PROGRAM CODE AND OUTPUT:


PROGRAM #60
Write a Python Program to check the First Occurrence of a character in a String

PROGRAM CODE AND OUTPUT:


PROGRAM #61
Write a Python Program to find the ASCII Value of a Character

PROGRAM CODE AND OUTPUT:

PROGRAM #62
Write a Python Program to Remove Last Occurrence of a Character in a String
PROGRAM CODE AND OUTPUT:

Case Study #1
A bank is a financial institution which is involved in borrowing and lending of money. With advancement in
technology, online banking, also known as internet banking allows customers of a bank to conduct a range of
financial transactions through the bank's website anytime, anywhere. As part of initial investigation you are suggested
to

collect a bank's application form. After careful analysis of the form, identify the information required for opening a
savings account. Also enquire about the rate of interest offered for a saving account.

The basic two operations performed on an account are Deposit and Withdrawal. Write a menu driven program that
accepts either of the two choices of Deposit and Withdrawal, then accepts an amount, performs the transactionand
accordingly displays the balance.Remember, every bank has a requirement of minimum balance which needs to be
taken care of during withdrawal operations. Enquire about the minimum balance required in your bank.

Collect the interest rates for opening a fixed deposit in various slabs in a savings bank account. Remember, rates may
be different for senior citizens.

Finally, write a menu driven program having the following options (use functions and appropriate data

types): Open a savings bank account

Deposit money

Withdraw money
Take details, such as amount and period for a Fixed Deposit and display its maturity amount for a particular customer.
PROGRAM CODE AND OUTPUT:

You might also like