🐍 Python Star Pattern A–Z
Print all uppercase alphabets using stars (*) in Python!
Python Star Pattern
🅰️ Letter A
rows = 7
for i in range(rows):
for j in range(rows):
if ((j == 0 or j == rows - 1) and i != 0) or \
((i == 0 or i == rows // 2) and (j > 0 and j < rows - 1)):
print("*", end="")
else:
print(" ", end="")
print()
🅱️ Letter B
rows = 7
for i in range(rows):
for j in range(rows):
if j == 0 or ((i == 0 or i == rows // 2 or i == rows - 1) and j < rows - 1) or \
(j == rows - 1 and not (i == 0 or i == rows // 2 or i == rows - 1)):
print("*", end="")
else:
print(" ", end="")
print()
©️Letter C
rows = 7
for i in range(rows):
for j in range(rows):
if (i == 0 or i == rows - 1) and j != 0 or \
(j == 0 and i != 0 and i != rows - 1):
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter D
rows = 7
for i in range(rows):
for j in range(rows):
if j == 0 or (j == rows - 1 and i != 0 and i != rows - 1) or ((i == 0 or i == rows - 1) and j < rows - 1):
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter E
rows = 7
for i in range(rows):
for j in range(rows):
if j == 0 or i == 0 or i == rows // 2 or i == rows - 1:
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter F
rows = 7
for i in range(rows):
for j in range(rows):
if j == 0 or i == 0 or i == rows // 2:
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter G
rows = 7
for i in range(rows):
for j in range(rows):
if (i == 0 and j != 0) or (i == rows - 1 and j != 0) or (j == 0 and i != 0 and i != rows - 1) or (j == rows - 1 and i >= rows // 2) or (i == rows // 2 and j >= rows // 2):
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter H
rows = 7
for i in range(rows):
for j in range(rows):
if j == 0 or j == rows - 1 or i == rows // 2:
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter I
rows = 7
for i in range(rows):
for j in range(rows):
if i == 0 or i == rows - 1 or j == rows // 2:
print("*", end="")
else:
print(" ", end="")
print()
🔤Letter J
rows = 7
for i in range(rows):
for j in range(rows):
if i == 0 or (j == rows // 2 and i != rows - 1) or (i == rows - 1 and j < rows // 2) or (j == 0 and i >= rows // 2):
print("*", end="")
else:
print(" ", end="")
print()
🔤Letter K
rows = 7
for i in range(rows):
for j in range(rows):
if j == 0 or i + j == rows // 2 or i - j == rows // 2:
print("*", end="")
else:
print(" ", end="")
print()
🔤Letter C
rows = 7
for i in range(rows):
for j in range(rows):
if j == 0 or i == rows - 1:
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter M
rows = 7
for i in range(rows):
for j in range(rows):
if j == 0 or j == rows - 1 or (i == j and i <= rows // 2) or (i + j == rows - 1 and i <= rows // 2):
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter N
rows = 7
for i in range(rows):
for j in range(rows):
if j == 0 or j == rows - 1 or i == j:
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter O
rows = 7
for i in range(rows):
for j in range(rows):
if ((j == 0 or j == rows - 1) and (i != 0 and i != rows - 1)) or ((i == 0 or i == rows - 1) and (j != 0 and j != rows - 1)):
print("*", end="")
else:
print(" ", end="")
print()
🅿️ Letter P
rows = 7
for i in range(rows):
for j in range(rows):
if j == 0 or (i == 0 or i == rows // 2) and j < rows - 1 or (j == rows - 1 and i > 0 and i < rows // 2):
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter Q
rows = 7
for i in range(rows):
for j in range(rows):
if ((j == 0 or j == rows - 2) and (i != 0 and i != rows - 2)) or ((i == 0 or i == rows - 2) and (j > 0 and j < rows - 2)) or (i == j and i >= rows // 2):
print("*", end="")
else:
print(" ", end="")
print()
®️ Letter R
rows = 7
for i in range(rows):
for j in range(rows):
if j == 0 or (i == 0 or i == rows // 2) and j < rows - 1 or (j == rows - 1 and i > 0 and i < rows // 2) or i - j == rows // 2:
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter S
rows = 7
for i in range(rows):
for j in range(rows):
if (i == 0 or i == rows // 2 or i == rows - 1) or (j == 0 and i < rows // 2) or (j == rows - 1 and i > rows // 2):
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter C
rows = 7
for i in range(rows):
for j in range(rows):
if i == 0 or j == rows // 2:
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter U
rows = 7
for i in range(rows):
for j in range(rows):
if (j == 0 or j == rows - 1) and i != rows - 1 or (i == rows - 1 and j > 0 and j < rows - 1):
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter V
rows = 7
for i in range(rows):
for j in range(2 * rows - 1):
if j == i or j == 2 * (rows - 1) - i:
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter W
rows = 7
for i in range(rows):
for j in range(2 * rows - 1):
if j == 0 or j == 2 * rows - 2 or (i == j and j < rows) or (i + j == 2 * rows - 2 and j >= rows - 1):
print("*", end="")
else:
print(" ", end="")
print()
✖️ Letter X
rows = 7
for i in range(rows):
for j in range(rows):
if i == j or i + j == rows - 1:
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter Y
rows = 7
for i in range(rows):
for j in range(rows):
if (i == j and i < rows // 2 + 1) or (i + j == rows - 1 and i < rows // 2 + 1) or (j == rows // 2 and i >= rows // 2):
print("*", end="")
else:
print(" ", end="")
print()
🔤 Letter Z
rows = 7
for i in range(rows):
for j in range(rows):
if i == 0 or i == rows - 1 or i + j == rows - 1:
print("*", end="")
else:
print(" ", end="")
print()