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

Python Code

The document contains a list of Python programming exercises categorized into five sections: Basic Python Programs, String and List-Based Programs, Loop-Based and Pattern Printing Programs, Dictionary and Tuple-Based Programs, and File Handling and Functions. Each section includes specific tasks such as checking if a number is even or odd, counting vowels in a string, generating Pascal's Triangle, and implementing a simple calculator. These exercises are designed to help practice and enhance Python coding skills.

Uploaded by

ASHOKA
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)
11 views

Python Code

The document contains a list of Python programming exercises categorized into five sections: Basic Python Programs, String and List-Based Programs, Loop-Based and Pattern Printing Programs, Dictionary and Tuple-Based Programs, and File Handling and Functions. Each section includes specific tasks such as checking if a number is even or odd, counting vowels in a string, generating Pascal's Triangle, and implementing a simple calculator. These exercises are designed to help practice and enhance Python coding skills.

Uploaded by

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

Python Code-Based Exam Practice

Questions
1. Basic Python Programs
1. Write a Python program to check if a number is even or odd.
2. Write a Python program to find the largest of three numbers.
3. Write a Python program to check if a given number is prime.
4. Write a Python program to reverse a number.
5. Write a Python program to calculate the factorial of a number.

2. String and List-Based Programs


6. Write a program to count the number of vowels in a given string.
7. Write a Python program to check if a string is a palindrome.
8. Write a program to swap consecutive elements in a list.
9. Write a Python program to find the second largest number in a list.
10. Write a Python program to merge two dictionaries into one.

3. Loop-Based and Pattern Printing Programs


11. Write a Python program to print the Fibonacci series up to N terms.
12. Write a program using nested loops to print a multiplication table.
13. Write a Python program to print a pyramid pattern using stars.
14. Write a program that prints all prime numbers in a given range.
15. Write a Python program to generate Pascal's Triangle up to N rows.

4. Dictionary and Tuple-Based Programs


16. Write a Python program to count the frequency of each character in a string.
17. Write a program to check if two given strings are anagrams.
18. Write a Python program to sort a dictionary by values in ascending and descending
order.
19. Write a program to split a list into two halves and store them in separate lists.
20. Write a Python program to find the sum of values in a dictionary.

5. File Handling and Functions


21. Write a program to read a file and count the number of words in it.
22. Write a Python function to check if a number is an Armstrong number.
23. Write a Python program to implement a simple calculator using functions.
24. Write a Python function to convert all uppercase letters in a string to lowercase and
vice versa.
25. Write a Python program to find and replace a word in a text file.

You might also like