This second series of Python beginner exercises introduces slightly more challenging tasks that help learners strengthen their fundamentals. Through practical problems like string manipulation, condition checks, loops, list processing, and simple algorithms, users can deepen their understanding while testing their ability to apply core Python concepts in real scenarios.
Exercise 1 — Temperature Converter (Celsius → Fahrenheit)
Objective: Practice arithmetic formulas and user input.
Task: Ask the user for a temperature in Celsius and convert it to Fahrenheit.
c = float(input("Enter temperature in Celsius: "))
f = (c * 9/5) + 32
print("Fahrenheit:", f)
Exercise 2 — Maximum of Three Numbers
Objective: Use conditional statements to compare values.
Task: Ask the user for three numbers and print the largest one.
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
c = float(input("Enter third number: "))
print("Largest number:", max(a, b, c))
Exercise 3 — Count Vowels in a Word
Objective: Work with loops, strings, and character checking.
Task: Ask the user for a word and count how many vowels it contains.
word = input("Enter a word: ")
vowels = "aeiouAEIOU"
count = 0
for char in word:
if char in vowels:
count += 1
print("Vowel count:", count)
Exercise 4 — Reverse a String
Objective: Use slicing or loops to manipulate strings.
Task: Write a program that reverses a word entered by the user.
word = input("Enter a word: ")
print("Reversed:", word[::-1])
Exercise 5 — Basic Password Strength Checker
Objective: Practice string conditions and logical operators.
Task: Ask the user for a password and check:
if length < 6 → "Weak"
if length 6–10 → "Medium"
if length > 10 → "Strong"
password = input("Enter a password: ")
if len(password) < 6:
print("Weak")
elif len(password) <= 10:
print("Medium")
else:
print("Strong")
Exercise 6 — Find the Smallest Number in a List
Objective: Work with lists and basic algorithms.
Task: Given a list of numbers, print the smallest element.
Task: Ask the user for a number and print a countdown to zero.
n = int(input("Enter a number: "))
for i in range(n, -1, -1):
print(i)
Exercise 8 — Prime Number Checker
Objective: Use loops + conditions to implement logic.
Task: Ask the user for a number and check whether it is prime.
num = int(input("Enter a number: "))
if num < 2:
print("Not prime")
else:
is_prime = True
for i in range(2, int(num**0.5) + 1):
if num % i == 0:
is_prime = False
break
print("Prime" if is_prime else "Not prime")
Exercise 9 — Remove Duplicates from a List
Objective: Learn to use sets or logic to filter unique values.
Task: Given a list with repeated values, print the list without duplicates.
💬 Comments
No comments yet. Be the first to comment!
Login to comment.