def printPattern(num, limit):
for i in range(1, limit + 1):
print(str(num) * i)
if __name__ == "__main__":
try:
num = int(input("Enter a number to repeat: "))
limit = int(input("Enter the limit for the pattern: "))
printPattern(num, limit)
except ValueError:
print("Please enter valid numbers.")
Python Code for Pattern Printing: How to repeat numbers in custom sequence
By -
January 09, 2024
0
Tags:
Post a Comment
0Comments