Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
14 views

Python Logic Worksheet

The document is a Python Logic Building Worksheet containing 40 exercises aimed at enhancing programming skills. It includes tasks such as counting digits, reversing numbers, calculating factorials, and checking for prime numbers. The exercises also cover string manipulation, list operations, and basic algorithm implementations.

Uploaded by

rishabh2005i
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)
14 views

Python Logic Worksheet

The document is a Python Logic Building Worksheet containing 40 exercises aimed at enhancing programming skills. It includes tasks such as counting digits, reversing numbers, calculating factorials, and checking for prime numbers. The exercises also cover string manipulation, list operations, and basic algorithm implementations.

Uploaded by

rishabh2005i
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
You are on page 1/ 3

Python Logic Building Worksheet

1. Count the number of digits in a number

Input: 1234 -> Output: 4

2. Reverse a number using a loop

Input: 123 -> Output: 321

3. Find the sum of digits of a number

Input: 456 -> Output: 15

4. Find the factorial of a number using a while loop

Input: 5 -> Output: 120

5. Print the multiplication table of any number

Input: 7 -> Output: 7x1=7 ... 7x10=70

6. Print a right-angled triangle pattern

Output:

**

***

7. Print a number pattern

Output:

12

123

8. Check if a number is prime

9. Generate Fibonacci series up to n terms

10. Check if a string is a palindrome

11. Find the largest of three numbers


12. Calculate the power of a number using loop

13. Convert binary to decimal

14. Count vowels in a string

15. Check if a year is a leap year

16. Find GCD of two numbers

17. Print all even numbers in a list

18. Remove duplicates from a list

19. Find the second largest number in a list

20. Merge two lists and sort them

21. Print all prime numbers in a given range

22. Find the average of numbers in a list

23. Check if a number is an Armstrong number

24. Convert a string to uppercase without using built-in function

25. Find factorial using recursion

26. Swap two numbers without using a third variable

27. Create a simple calculator using functions

28. Find all the divisors of a number

29. Count words in a sentence

30. Check if a number is a perfect number

31. Remove all punctuation from a string

32. Flatten a nested list

33. Print numbers in reverse order using recursion

34. Print the ASCII value of characters in a string

35. Print common elements in two lists


36. Count frequency of each element in a list

37. Implement a simple login system using dictionary

38. Find the most frequent character in a string

39. Create a number guessing game

40. Build a CLI menu-driven program for basic math operations

You might also like