0% found this document useful (0 votes)
3 views2 pages

Python Practice Problems

The document outlines a series of Python practice problems categorized into various topics such as Numbers, If Statements, For Loops, Strings, Lists, While Loops, Dictionaries, Text Files, and Functions. Each category includes specific tasks aimed at enhancing programming skills, such as checking if a number is even or odd, counting word frequencies, and generating Fibonacci numbers. These exercises are designed for learners to practice and improve their Python coding abilities.

Uploaded by

Nabil
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Python Practice Problems

The document outlines a series of Python practice problems categorized into various topics such as Numbers, If Statements, For Loops, Strings, Lists, While Loops, Dictionaries, Text Files, and Functions. Each category includes specific tasks aimed at enhancing programming skills, such as checking if a number is even or odd, counting word frequencies, and generating Fibonacci numbers. These exercises are designed for learners to practice and improve their Python coding abilities.

Uploaded by

Nabil
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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.

You might also like