0% found this document useful (0 votes)
36 views

Computer Practical

The document contains examples of code snippets to solve various programming problems. It includes 25 problems covering topics like calculating area and perimeter of shapes, finding factors of numbers, working with data types like lists, tuples and dictionaries.

Uploaded by

Prapti Adhikari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Computer Practical

The document contains examples of code snippets to solve various programming problems. It includes 25 problems covering topics like calculating area and perimeter of shapes, finding factors of numbers, working with data types like lists, tuples and dictionaries.

Uploaded by

Prapti Adhikari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

1. Write a program that accepts radius of a circle and print its area.

Code:

Output:

2. Write a program that inputs a student’s marks in three subjects (out of


100) and prints the percentage marks.

Code:

Output:

3. Write a program to find simple interest.


Code:

Output:

4. Write a program to find whether a given number is even or odd.

Code:

Output:
5. Write a program that reads two numbers and prints their quotient and
remainder.

Code:

Output:

6. Write a program to find lowest among three intergers.


Code:

Output:

7. Write a program to accept the height in cm and convert it into feet and
inches.

Code:

Output:
8. Write a program that accepts two numbers and check if the first number
is fully divisible by second number or not.

Code:

Output:

9. Write a program to accept the year and check if it is a leap year or not.
Code:

Output:

10. Write a program to obtain x, y, z and calculate 4x4+3y3+9z+6π.

Code:

Output:
11. Write a program to input percentage marks of a student and find
the grade as per the following criteria.

Marks Grade
>=90 A
75-90 B
60-75 C
Below 60 D

Code:

Output:

12. Write a program to display a menu for calculating area of circle or


perimeter of circle.

Code:
Output:

13. Write a program to print whether a given character is an uppercase


or a lowercase character or a digit or any other character.

Code:
Output:

14. Write a program to print the sum of natural numbers between 1 to


7.

Code:
Output:

15. Write a program to calculate the factorial of a number.

Code:

Output:

16. Write a program to create a triangle of stars using nested loop.

Code:
Output:

17. Write a python script to print Fibonacci series’ first 20 elements.

Code:

Output:
18. Write a program to read an integer >1000 and reverse the number.

Code:

Output:
19. Write a program to print a pattern like:
4321
432
43
4

Code:

Output:

20. Program that reads a line and print its statistics like:
Number of uppercase letters:
Number of lowercase letters:
Number of alphabets:
Number of digits:
Number of occurrences of a substring:

Code:

Output:
21. Write a program to input a list and to remove all occurrences of the
given element from the list.

Code:

Output:

22. Write a program to create a list of even numbers between 20 and


60 and to calculate the mean, median and mode of the list.
Code:

Output:

23. Write a program to input names of n student and store it in tuple.


Also, input a name from user and find if the student is present in the
tuple or not.

Code:

Output:
24. Write a python program to find the largest value in a dictionary.

Code:

Output:

25. Create a dictionary whose keys are month names and values are
number of days in the corresponding months.

a. Display the number of days for a user input month.


Code:

Output:

b. Display all keys in alphabetical order.

Code:

Output:

c. Display all months with 31 days.

Code:
Output:

d. Display all key-value pairs sorted by number of days in each month.

Code:

Output:

You might also like