Practice Python Problems - doraithodla/notes GitHub Wiki
Generated by PyTutor
Here are 10 simple Python exercises you can try:
- Write a program that asks the user for their name and then greets them by name.
- Write a program that accepts a string and prints the number of characters in the string.
- Write a program that takes a list of numbers and prints out the sum of all the numbers in the list.
- Write a program that accepts a string and prints it in reverse order.
- Write a program that takes two numbers as input and prints their product.
- Write a program that asks the user for a number and then checks if the number is prime or not.
- Write a program that accepts a list of numbers and prints out the largest number in the list.
- Write a program that converts Celsius to Fahrenheit. The formula is: F = (C * 1.8) + 32.
- Write a program that accepts a string and checks if the string is a palindrome or not.
- Write a program that accepts a list of integers and removes duplicates from the list.
- Write a script that extracts all email addresses from a text file.
- Write a Python program to find the most common words in a text file.
- Write a program that takes a list of numbers, and returns a new list where every element is the sum of itself and all previous elements.
- Write a program to find the second smallest number in a list.
- Write a function that takes a filename as an argument, and returns the number of lines, words, and characters in the file.
- Write a program that takes a string and returns a list of all the permutations of that string.
- Write a program that takes two lists and returns a list of all the elements that appear in both lists.
- Write a function that takes a list of numbers as input and returns the product of all the numbers in the list.
- Write a program that takes a list of numbers and returns a new list with all the duplicates removed.
- Write a program that takes a list of numbers and returns a new list with only the even numbers.
- Write a program that takes a list of strings and sorts them in alphabetical order, ignoring case.
- Write a program that takes a list as input and returns a new list with all duplicate elements removed while preserving the original order.
- Write a program that reads a file and reverses its contents line by line.
- Write a program that takes a list of integers and returns the greatest common divisor.
- Write a program that takes a list of integers and returns the least common multiple.
- Write a program that takes a string as input and returns the length of the longest palindrome in the string.
- Write a program that takes a list of tuples, where each tuple contains a name and an age, and sorts the list by age.
- Write a program that takes a list of integers and returns the smallest number that can be made by arranging the digits of those numbers.
- Write a program that takes a list of integers and removes all the odd numbers from the list.
- Write a Python program that takes a string as input and returns the number of times each word appears in the string.
:1. Currency Converter
2. To-do list application
3. Simple calculator
4. Password generator
5. Image resizer
6. Website URL status checker
7. File renaming tool
8. Text file analyzer
9. Web scraper
10. Email sender
11. Markdown to HTML converter
12. Random quote generator
13. PDF merger
14. YouTube video downloader
15. Sudoku solver
16. Hangman game
17. Tic-tac-toe game
18. Rock-paper-scissors game
19. Morse code translator
20. Web chat application.These applications may seem small to intermediate level programmers, but they can be challenging to implement and can help improve your Python programming skills.