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

Python Programs

The document provides 20 examples of Python programs covering a range of tasks like analyzing lists and strings, file handling, date and time operations, spreadsheet operations, regular expressions, exception handling, and working with JSON data. Many of the programs involve accepting user input, processing and analyzing the input, and returning output like counts, longest words, or conversions between temperature scales. Overall, the programs demonstrate a variety of common programming concepts and tasks in Python.

Uploaded by

Ravi Ar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Python Programs

The document provides 20 examples of Python programs covering a range of tasks like analyzing lists and strings, file handling, date and time operations, spreadsheet operations, regular expressions, exception handling, and working with JSON data. Many of the programs involve accepting user input, processing and analyzing the input, and returning output like counts, longest words, or conversions between temperature scales. Overall, the programs demonstrate a variety of common programming concepts and tasks in Python.

Uploaded by

Ravi Ar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Python Programs

1. WAP to create a list of numbers and return the count of even and odd numbers from the
list.
2. WAP to accept a sentence as input and return the longest word in the given sentence
along with its length.
3. WAP to traverse the dictionary and display the most populous city.
4. WAP that takes a number N from command line and creates an NxN multiplication table
in an excel spread sheet.
5. WAP that uses datetime module within a class, accepts a birthday as input and print
user’s age and the number of days, hours, minutes and seconds until their next birthday.
6. WAP to create a folder “PYTHON” and under the hierarchy 3 files – file1, file2 & file3.
Write the content in file1 as “VTU” and in file2 as “UNIVERSITY” and file3 content should
be opening and merge of file1 and file2. Check out the necessary condition before writing
file3.
7. WAP to extract Phone numbers and Email addresses using Regular Expressions.
8. WAP to swap cases of the given string –
Input: Java
Output: jAVA
9. WAP to accept a sentence as input, compute and return the number of words, digits,
uppercase and lowercase letters.
10. WAP to count the frequency / no. of occurrences of character in a string.
11. WAP to solve divide by zero error situation using the concept of exception handling.
12. WAP to check whether the given number is even or odd.
13. Using the concept of exception handling, implement a code which prompts the user for
Celsius temperature , converts the temperature to Fahrenheit & print the converted
temperature by handling the exception.
14. Create a function to print out a blank tic – tac – toe board.
15. Write a program that reads a string with 5 characters which starts with ‘a’ and ends with
‘z’. Print search is successful if pattern matches the string.
16. Use the datetime module to write a program that accepts the current date as input and
prints that day of the week.
17. Write a function called printTime that takes a time object and print it in the form
hour: minute: second.
18. WAP to access cells in a worksheet.
19. WAP to get a list of all files with .pdf extension in the current working directory and sort
them.
20. WAP for demonstration of JSON module.

You might also like