Problem 6: Counting Vowels in a String
Create a Python program that counts the number of vowels (a, e, i, o, u, case-insensitive)
text = input("Enter a string: ")
count = 0 vowels = "aeiouAEIOU"
for char in text: if char in
vowels: count += 1
print("Number of vowels:", count)
Problem 7: Finding the Largest Digit in an Integer
num = int(input("Enter a positive integer: "))
largest = 0
while num > 0:
digit = num % 10 if
digit > largest: largest
= digit num //= 10
print("Largest digit:", largest)
Problem 8: Factorial of a Given Number
num = int(input("Enter a number: "))
fact = 1
for i in range(1, num + 1): fact
*= i print("Factorial of", num, "is",
fact)
Problem 9: Palindrome Checker
text = input("Enter a string: ")
text = [Link]() reverse = ""
for char in text:
reverse = char + reverse
if text == reverse:
print("It is a palindrome!")
else: print("Not a
palindrome.")
Problem 10: Nested Loop Pattern
Example:
Output:
1
12
123
1234
12345
rows = int(input("Enter number of rows: "))
for i in range(1, rows + 1):
for j in range(1, i + 1):
print(j, end=" ") print()