Develop a function in Python to generate the following pattern
1 AB 123 ABCD 12345 ABCDEF 1234567
Solution
n = int(input("Enter the pattern size: "))
for i in range(1, n+1):
#sauravhathi
for j in range(1, i+1):
if i % 2 == 0:
print(chr(j+64), end="")
else:
#sauravhathi
print(j, end="")
print("\r")
Output:
Happy Learning – If you require any further information, feel free to contact me.