0% found this document useful (0 votes)
6 views23 pages

Python Programming Exercises for XI-A

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)
6 views23 pages

Python Programming Exercises for XI-A

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

PRACTICAL FILE

NAME: - HARDIK CHAUHAN


CLASS: - XI-A
ROLL NO.: - 12
TEACHERS NAME: - POOONAM
MA’AM
DATE OF SUBMISSION: –
03/10/23
SESSION: - (2023-23)
INDEX
S.N NAME OF REMARK
O PROGRAM S
1. Write a program to accept the radius of a sphere
from the user and display its area and volume.
Area=πr2 and volume=4πr3
2. Write a program to accept a number from the user
and display its factorial.
3. Write a program to accept a number from the user
and display whether it is a palindrome number or
not
4. Write a program to accept a number from the user
and display whether it is a prime number or not.
5. Write a program that reads a string and print its
statistics like : Number of Uppercase letters,
Number of lowercase letters, Number of alphabets,
Number of digits, Number of symbols.

6. Write a program that asks the user for a string s and


character c and then it prints the location of the
character c in the string s.

7. Write a program to input a list and an element, and


remove all occurrences of the given element from
the list.

8. Extract two list slices out of the given list of


numbers. Display and print the sum of elements of
list slice which contains every other element of the
list between indexes 5 to 15. Program should display
the average of elements in second list slice that
contains every fourth element of the given list. The
list contains numbers 1 to 20.

9. Write a program 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.

10. Write a program to check if a tuple contains any


duplicate elements.

11. Write a program to create a dictionary with the roll


number, name and marks of n students in a class
and displays the names of students who have marks
above 75.

12. Write a Python program that takes a value and


checks whether the given value is part of given
dictionary or not. If it is, it should print the
corresponding key otherwise print an error
message.

13. Python Programs for printing pyramid patterns

14. Compute the greatest common divisor and least


common multiple of two integers

15. Find the smallest number in a list/tuple

16. Find the largest number in a list/tuple.

17. Display the terms of a Fibonacci series Python


Program

18. Python Program to input 2 numbers and display


larger number

19. Write a program to display n terms of natural


number and their sum

20. Write a program to display the multiplication table


of a given integer
Program-1 :
Write a program to accept the radius of a sphere
from the user and display its area and volume.
Area=πr2 and Volume=4πr3

Code –

Output-
Program-2:
Write a program to accept a number from the
user and display its factorial.

Code –

Output-

Program-3:
Write a program to accept a number from the
user and display whether it is a palindrome
number or not

CODE-

OUTPUT

Program-4:
Write a program to accept a number from the
user and display whether it is a prime number or
not.

CODE –

OUTPUT-

Program-5:
Write a program that reads a string and print its
statistics like : Number of Uppercase letters, Number of
lowercase letters, Number of alphabets, Number of
digits, Number of symbols.
CODE –

OUTPUT-

Program-6:
Write a program that asks the user for a string s and
character c and then it prints the location of the
character c in the string s.

CODE-

OUTPUT-

Program-7:
Write a program to input a list and an element, and
remove all occurrences of the given element from the
list.

CODE-

OUTPUT-

Program-8:
Extract two list slices out of the given list of numbers.
Display and print the sum of elements of list slice which
contains every other element of the list between
indexes 5 to 15. Program should display the average of
elements in second list slice that contains every fourth
element of the given list. The list contains numbers 1 to
20.

CODE-

OUTPUT-

Program-9:
Write a program 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.

CODE-

OUTPUT-

Program-10:
Write a program to check if a tuple contains any
duplicate elements.
CODE-

OUTPUT-

Program-11:
Write a program to create a dictionary with the roll
number, name and marks of n students in a class and
displays the names of students who have marks above
75.
CODE-

OUTPUT –

Program-12:
Write a Python program that takes a value and checks
whether the given value is part of given dictionary or
not. If it is, it should print the corresponding key
otherwise print an error message.

CODE-

OUTPUT-

Program-13:
Python Programs for printing pyramid patterns -
CODE-
OUTPUT-

Program-14:
Compute the greatest common divisor and least
common multiple of two integers
CODE-
OUTPUT-

Program - 15
Find the smallest number in a list/tuple

CODE –
OUTPUT-

Program 16:
Find the largest number in a list/tuple.
CODE-
OUTPUT-

Program 17:
Display the terms of a Fibonacci series Python
Program
CODE-
OUTPUT –

Program 18:
Python Program to input 2 numbers and display
larger number
CODE-

OUTPUT-

Program 19:
Write a program to display n terms of natural
number and their sum
CODE –
OUTPUT-

Program 20:
Write a program to display the multiplication
table of a given integer
CODE –
Output –

You might also like