# Math πrate and Sam have reached the finale of their quest.
# They need your help. Are you ready?
''' Task 1: Number Match'''
print("***** Task 1: *****")
print()
# In this round, you need to print the below pattern:
# 1 2 3 4 5
# 1 2 3 4 5
# 1 2 3 4 5
# 1 2 3 4 5
# User inputs the maximum number to be printed
# Display the numbers from 1 upto the maximum number
# Repeat the pattern 4 times
# Any ideas how would you do it? Did you notice the pattern ? Can you display the pattern using a single loop?
# Hint: We can do this by using 2 loops. One for printing the numbers from 1 till the number entered by the user on the same row. Second for printing the above row 4 times
# Give it a try
times = int(input("Enter the limit number for the pattern:"))
sub = 0
for i in range(1,5):
for w in range(1,times + 1):
print(w, end = " ")
print("\n")
''' Task 2: Pattern to begin with '''
print("***** Task 2: *****")
print()
# You have been given your next challenge .
# Write a program to print the following pattern using nested for loops:
# *
# * *
# * * *
# * * * *
# * * * * *
# * * * * * *
# * * * * * * *
# * * * * * * * *
# * * * * * * * * *
for i in range(1,10):
print("* " * i)
''' Task 3: Lets reverse it '''
print("***** Task 3: *****")
print()
# Now time to reverse the pattern that you just coded in Task 2, Remember the pattern you now need to create is:
# * * * * * * * * *
# * * * * * * * *
# * * * * * * *
# * * * * * *
# * * * * *
# * * * *
# * * *
# * *
# *
for i in range(1,10):
x = 10 - i
print("* " * x)
''' Task 4: Combination Pattern'''
print("***** Task 4: *****")
print()
# Looking at your progress here comes another quest
# Write a program to create the following pattern:
# *
# * *
# * * *
# * * * *
# * * * * *
# * * * *
# * * *
# * *
# *
for i in range(1,10):
print("* " * i)
for i in range(1,10):
x = 10 - i
print("* " * x)
# Hint: It is a combination of what you did in Task 2 and 3
''' Great! You are getting to understand the mechanics of a nested for loop '''
To embed this project on your website, copy the following code and paste it into your website's HTML: