0% found this document useful (0 votes)
2 views5 pages

Python Programming Worksheet

This document is a Python programming worksheet for Class 10, containing exercises on variables, operators, conditional statements, loops, nested loops, number-based programs, functions, and lists. Each section includes specific tasks such as accepting user input, performing calculations, and implementing control structures. The worksheet aims to enhance students' programming skills through practical coding exercises.

Uploaded by

virajchavancr7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Python Programming Worksheet

This document is a Python programming worksheet for Class 10, containing exercises on variables, operators, conditional statements, loops, nested loops, number-based programs, functions, and lists. Each section includes specific tasks such as accepting user input, performing calculations, and implementing control structures. The worksheet aims to enhance students' programming skills through practical coding exercises.

Uploaded by

virajchavancr7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Programming Worksheet

Class 10

Variables and Operators

1. Write a Python program to accept the name, age and city of a student and
display the entered details.

2. Write a Python program to accept two numbers and display their sum,
difference, product, quotient and remainder.

3. Write a Python program to calculate the area and perimeter of a rectangle.

4. Write a Python program to accept temperature in Celsius and convert it into


Fahrenheit.

5. Write a Python program to accept the principal amount, rate of interest and time
and calculate simple interest.

Conditional Statements

6. Write a Python program to accept an integer and check whether it is positive,


negative or zero.

7. Write a Python program to accept an integer and check whether it is even or odd.

8. Write a Python program to accept three numbers and display the greatest
number using nested if statements.

9. Write a Python program to accept a person’s age and check whether the person
is eligible to vote.

10. Write a Python program to accept a number and check whether it is divisible by
both 5 and 11.

11. Write a Python program to accept marks and display the grade according to the
following criteria:

Marks Grade

90 and above A

75 to 89 B

60 to 74 C

40 to 59 D

Below 40 Fail

12. Write a Python program using match-case to create a simple calculator. Accept
two numbers and an operator such as +, -, * or / from the user.
13. Write a Python program using match-case to display the name of a day when the
user enters a number from 1 to 7.

For and While Loops

14. Write a Python program to print numbers from 1 to 20 using a for loop.

15. Write a Python program to print all even numbers between 1 and 50.

16. Write a Python program to accept a number and print its multiplication table
from 1 to 10.

17. Write a Python program to accept a positive integer and calculate the sum of
natural numbers from 1 to that number using a while loop.

18. Write a Python program to find the factorial of a number.

19. Write a Python program to accept an integer and calculate the sum of its digits.

20. Write a Python program to accept an integer and display its digits in reverse
order.

21. Write a Python program to count the total number of digits present in an integer.

22. Write a Python program to print numbers from 1 to 10, but stop the loop when
the number becomes 6 using the break statement.

23. Write a Python program to print numbers from 1 to 10, but skip the number 5
using the continue statement.

24. Write a Python program demonstrating the use of the pass statement inside a
loop.

Nested Loops and Patterns

25. Write a Python program to print the following pattern using nested loops:

**

***

****

26. Write a Python program to print the following pattern using nested loops:

*****

****

***

**

*
27. Write a Python program to print the following number pattern using nested loops:

12

123

1234

12345

28. Write a Python program to print the following number pattern:

22

333

4444

55555

29. Write a Python program to print the following pattern:

54

543

5432

54321

Number-Based Programs

30. Write a Python program to accept an integer from the user and check whether it
is an Armstrong number.

An Armstrong number is a number that is equal to the sum of its digits, where each digit
is raised to the power of the total number of digits.

For example:

153 = 1³ + 5³ + 3³

153 = 1 + 125 + 27

153 = 153

Therefore, 153 is an Armstrong number.

31. Write a Python program to accept an integer and check whether it is a


palindrome number.
32. Write a Python program to accept a number and check whether it is a prime
number.

33. Write a Python program to display all prime numbers between 1 and 100.

34. Write a Python program to accept a number and check whether it is a perfect
number.

Loops with Iterables

35. Create a list containing five colours and display each colour using a for loop.

36. Create a tuple containing five numbers and display each number using a loop.

37. Accept a string from the user and display each character on a separate line.

38. Accept a string from the user and count the total number of vowels present in it.

39. Create a dictionary containing student names and marks. Display each student’s
name and marks using a loop.

Functions

40. Write a Python program to create a user-defined function that accepts two
numbers and displays their sum.

41. Write a Python program to create a function that accepts a number and returns
its square.

42. Write a Python program to create a function that accepts a number and returns
whether it is even or odd.

43. Write a Python program to create a function that accepts the length and breadth
of a rectangle and returns its area.

44. Write a Python program to create a function with a default argument that
displays a welcome message.

45. Write a Python program to create a function that accepts three fixed arguments
and returns the greatest number.

46. Write a Python program to create a function using *args that calculates and
returns the sum of all the values passed to it.

47. Write a Python program to create a function using *args that returns the largest
number among the values provided.

Lists

48. Write a Python program to create a list containing the names of five students and
display the first and last elements.

49. Write a Python program to accept five numbers from the user and store them in a
list.
50. Write a Python program to create a list and add a new element at the end using
append().

51. Write a Python program to insert an element at a particular position using


insert().

52. Write a Python program to combine two lists using extend().

53. Write a Python program to arrange the elements of a list in ascending and
descending order.

54. Write a Python program to accept an element from the user and search for it in a
list.

55. Write a Python program to find the largest and smallest elements in a list.

56. Write a Python program to calculate the sum and average of all elements in a list.

57. Write a Python program to count the number of even and odd elements in a list.

58. Write a Python program to perform the following list operations:

 Create a list containing five numbers.

 Display the list.

 Append a new number.

 Insert a number at the second position.

 Extend the list using another list.

 Sort the list.

 Search for a number entered by the user.

You might also like