← Back to Dashboard

Control Flow Conditionals Loops: Hard Exercises HARD

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

# Exercise 1: Implement the "FizzBuzz" challenge.
# Print numbers 1 to 100. For multiples of 3, print "Fizz". 
# For multiples of 5, print "Buzz". For multiples of both, print "FizzBuzz".
# Write your code below:


# Exercise 2: Write a program to find all Armstrong numbers between 1 and 1000.
# (An Armstrong number is a number that is equal to the sum of cubes of its digits).
# Write your code below:


# Exercise 3: Pattern Printing - Pascal's Triangle.
# Print the first 5 rows of Pascal's Triangle.
#       1
#      1 1
#     1 2 1
#    1 3 3 1
#   1 4 6 4 1
# Write your code below:


# Exercise 4: Create a simple ATM machine simulation.
# Use a while loop to show a menu: 1. Check Balance, 2. Deposit, 3. Withdraw, 4. Exit.
# Use variables to track state.
# Write your code below:


# Exercise 5: Write a program to find the GCD (Greatest Common Divisor) of two numbers.
# Hint: Use the Euclidean algorithm or a loop.
# Write your code below:


# Exercise 6: Verifying Primality - Ask for a number and find out if it's prime.
# Handle edge cases like 1 and negative numbers.
# Write your code below:


# Exercise 7: Text-based Adventure Game (Mini).
# Use if-elif-else and loops to create a multi-step game where choices matter.
# Example: "You are in a dark room. Do you go left or right?"
# Write your code below:


# Exercise 8: Diamond Pattern Printing.
#    *
#   ***
#  *****
#   ***
#    *
# Write your code below:


# Exercise 9: Implement the Collatz Conjecture.
# If number is even, divide by 2. If odd, multiply by 3 and add 1.
# Repeat until the number becomes 1. Print it at each step.
# Write your code below:


# Exercise 10: Find the sum of the first n terms of the series: 1 + 11 + 111 + 1111 + ...
# Write your code below: