Python Exercise 12
Hi,
Please click this link for 1-20 questions.
You can copy the content present in the following file and create a new file with any name, for doing the programs from 21 to 31.
Input file: file1
21. Write a python script to print the contents of the file and print the longest word in the file?
22. Write a python script to print the unique words i.e. remove duplicate words, in the given file?
23. Write a python script to print the number of times each word occurred in a given file?
24. Write a python script to print the number of times each word occurred in a given file in sorted order?
25. Write a python script to print the number of times each word occurred in a given file in reverse sorted order?
26. Write a python script to print only the words which contains numbers only?
27. Write a python script to print how many times the word ‘python’ is coming in a given file.
Note: The word python is not case sensitive here.
28. Write a python script to copy the contents of the given file to another file?
29. Write a python script to create 10 files using loops. Each file should contains “Hello World”.
30. Write a python script to create 10 files using loops. Each file contains numbers from 1 to 100.
31.Write a python script to create 10 files using loops.
Note: First file contains numbers from 1 to 99, Second file contains numbers from 100 to 199, third file contains numbers from 200 to 299, and so on.