← Back to Dashboard

Control Flow Conditionals Loops: Medium Exercises MEDIUM

"""
Topic 03: Control Flow (Conditionals & Loops) - MEDIUM Exercises (10)
"""

# Exercise 1: Write a program to find the factorial of a number using a for loop.
# Example: 5! = 5 * 4 * 3 * 2 * 1 = 120
# Write your code below:


# Exercise 2: Print the Fibonacci sequence up to n terms provided by the user.
# Hint: 0, 1, 1, 2, 3, 5, 8...
# Write your code below:


# Exercise 3: Use a loop to count the number of vowels in a string provided by the user.
# Write your code below:


# Exercise 4: Create a multiplication table (from 1 to 10) for a number entered by the user.
# Write your code below:


# Exercise 5: Find the sum of all prime numbers between 1 and 50.
# Write your code below:


# Exercise 6: Write a "Guess the Number" game. 
# The program picks a secret number, and the user has to guess it. 
# Tell the user if their guess is too high or too low.
# Write your code below:


# Exercise 7: Take a string from the user and print it in reverse using a loop (don't use slicing [::-1]).
# Write your code below:


# Exercise 8: Pattern Printing - Print a right-angled triangle of stars.
# *
# **
# ***
# ****
# Write your code below:


# Exercise 9: Write a program that takes a number from the user and calculates the sum of its digits.
# Write your code below:


# Exercise 10: Use nested loops to print a 5x5 grid of coordinates.
# Example: (0,0) (0,1) ... (4,4)
# Write your code below: