Python Practice Problems
Numbers
1. Write a program that checks if a number is even or odd.
2. Compute the sum of all numbers from 1 to 100.
If Statements
1. Ask the user for a number and print whether it's positive, negative, or zero.
2. Create a grading system based on a numeric score.
For Loops
1. Print all multiples of 3 from 1 to 100.
2. Count how many vowels appear in a given string.
Strings
1. Reverse a string without using slicing.
2. Count occurrences of each character in a string.
Lists
1. Remove duplicates from a list.
2. Find the largest and smallest elements in a list.
More with Lists
1. Flatten a nested list.
2. Rotate a list left by one position.
While Loops
1. Keep asking the user for input until they type 'exit'.
2. Generate Fibonacci numbers up to 100.
Dictionaries
1. Count word frequencies in a sentence using a dictionary.
2. Swap keys and values in a dictionary.
Text Files
1. Read a file and count its lines.
2. Write a list of numbers to a file, one per line.
Functions
1. Write a function that returns the factorial of a number.
2. Write a function that checks whether a string is a palindrome.