CS Prctical File Class XI
CS Prctical File Class XI
Subject: Computer
Science
1
2
INDEX
Pr. Da Topic Page Teacher’
No te no s
sign
1 Write a python program to input a welcome message and display
it.
2 Write a python program to input two numbers and display the
larger /
smaller number.
3 Write a python program to input three numbers and display the
largest
/smallest number.
4 Generate the following patterns using nested loop.
5 Write a program to input the value of x and n and print the sum of
the following series:
a.1 + x2 + x3 + ... + xn
b. x - x2/2! + x3/3! - x4/4! + x5/5! - x6/6!
3
12 Write a menu drive program to the following from the list:
1.Maximum
2.Minimum
3.Sum
4.Sort in Ascending
5.Sort in Descending
6.Exit
4
20 Write a program to enter a team name, wins and losses of a
team. Store them into a dictionary where teams names are key
and winds and losses are values stored as a list. Do the
following based on the dictionary created above:
• Find out the team’s winning percentage by their names
• Display the no. of games won by each team in a list
• Display the no. of games lost by each team in a list
5
Ex.No:-
1 PROGRAM TO INPUT A WELCOME MESSAGE AND DISPLAY IT
Date:-
Aim:
Coding:
Output:
6
Ex.No:- 2 Write a python program to input two numbers and display the larger /smaller
number
Date:-
code:
output:
7
EX No.3 Write a python program to input three numbers and display the largest/smallest
number.
Code:
Output:
Output:
9
EX No.5 Write a program to input the value of x and n and print the sum of the following series:
a. 1 + x2 + x3 + ... + xn
b. x - x2/2! + x3/3! - x4/4! + x5/5! - x6/6!
Code for a :
Output:
Code for b:
10
Output:
11
Code:
Output:
EX No.7 Write a program to input a number and check if the number is a prime or composite
number
12
Code:
Output:
Code:
13
Output:
EX No.9 Write a python program to compute the greatest common divisor and least common
multiple of two integers.
Code:
14
Output:
EX no.10 Write a program to count and display the number of vowels, consonants, uppercase,
lowercase characters in string.
Code:
15
Output:
EX No.11 Write a menu driven program for list manipulation. Display menu as:
1.Add a record
2.View record
3.Delete Record
16
4.Modify record
5.Exit
Code:
17
Output:
18
EX No.12 Write a menu drive program to the following from the list:
1.Maximum
19
2.Minimum
3.Sum
4.Sort in Ascending
5.Sort in Descending
6.Exit
Code:
Output:
20
EX No.13 Write a program to input a list of numbers and swap elements at the even location with
the elements at the odd location.
21
Code:
Output:
EX No.14 Write a program to input a list of number and interchange first element to last element.
22
Code:
Output:
EX No.15 Write a program to create a tuple with user input and search for given element.
Code:
23
Output:
EX No.16 Write a program to create tuple with user input and display the square of numbers
divisible by 3 and display cube of numbers divisible by 5.
Code:
24
Output:
Code:
Output:
26
27
EX No.18 Write a program to Create a dictionary with the roll number, name and marks of n
students in a class and display the names of students who have scored marks above 75.
Code:
Output:
28
EX No.19 Write a program to create a dictionary and store salesman name as a key and sales of
3 months as values. Give the bonus to the salesman according to the given criteria:
1.Total Sales < 10K – No Bonus
2.Total Sales 10K to 20K – 5%
3.Total Sales 21K to 30K – 8%
4.Total Sales 31K to 40K – 10%
Code:
Output:
Ex No.20 Write a program to enter a team name, wins and losses of a team. Store them into a
dictionary where teams names are key and winds and losses are values stored as a list. Do the
following based on the dictionary created above:
29
• Find out the team’s winning percentage by their names
• Display the no. of games won by each team in a list
• Display the no. of games lost by each team in a list
Code:
Output:
30