diff --git a/Patterns/pattern6.py b/Patterns/pattern6.py new file mode 100644 index 00000000000..1f02d6ce55a --- /dev/null +++ b/Patterns/pattern6.py @@ -0,0 +1,17 @@ +# Python code to print the following alphabet pattern +#A +#B B +#C C C +#D D D D +#E E E E E +def alphabetpattern(n): + num = 65 + for i in range(0, n): + for j in range(0, i+1): + ch = chr(num) + print(ch, end=" ") + num = num + 1 + print("\r") + +a = 5 +alphabetpattern(a)