For Loop Problems (5)
1. Print Numbers from 1 to 10
Write a program using a for loop that prints numbers from 1 to 10.
2. Print Squares of First 5 Natural Numbers
Use a for loop to print the squares of the first 5 natural numbers (1² to 5²).
3. Print Each Character in a String
Take a string as input and print each character on a new line using a for loop.
Example: "Python" → P, y, t, h, o, n
4. Print Even Numbers Between 2 to 200
5. Count Vowels in a Word
Take a word as input and count how many vowels it contains using a for loop.
Hint: vowels are a, e, i, o, u
Example:
In word ‘university’, the vowels are u, i, e, i.
List Problems (3)
6. Add and Remove Elements
Start with an empty list.
• Append "apple", "banana", and "cherry" to the list
• Then remove "banana"
• Print the final list
7. Sort a List of Numbers
Given a list of numbers [5, 3, 8, 1, 4],
• Sort the array and print the list-
1. In ascending order
2. In descending order
8. Reverse a List
Given a list ["a", "b", "c", "d"],
• Reverse the list and pop() the 2nd element
• Print the result
Do these problems, run in your own machine and then send in the group or any mentor’s id.