This article shows how to write a Python program to print the Alphabet F star pattern using the for loop, while loop, and functions with an example.
The below alphabet F star pattern example accepts the user-entered rows and the nested for loop iterates the rows. The Python If else condition is to print stars at the first row, first column, and middle row positions to get the Alphabet F pattern of stars and skip others.
rows = int(input("Enter Alphabet F of Stars Rows = "))
print("====The Alphabet F Star Pattern====")
for i in range(rows):
print('*', end='')
for j in range(rows):
if i == 0 or (i == rows // 2 and j <= rows // 2):
print('*', end='')
else:
continue
print()

Python program to print the Alphabet F Star pattern using while loop
Instead of a for loop, this program uses a while loop to iterate the Alphabet F pattern rows and print the stars at each position. For more, check the Python Star Pattern programs.
rows = int(input("Enter Alphabet F of Stars Rows = "))
i = 0
while i < rows:
print('*', end='')
j = 0
while j < rows:
if i == 0 or (i == rows // 2 and j <= rows // 2):
print('*', end='')
else:
j += 1
continue
j += 1
print()
i += 1
Enter Alphabet F of Stars Rows = 13
**************
*
*
*
*
*
********
*
*
*
*
*
*
In this Python Program example, we created an FPattern function that accepts the rows and the symbol or character to print the Alphabet F pattern of the given symbol.
def FPattern(rows, ch):
for i in range(rows):
print('%c' %ch, end='')
for j in range(rows):
if i == 0 or (i == rows // 2 and j <= rows // 2):
print('%c' %ch, end='')
else:
continue
print()
row = int(input("Enter Alphabet F of Stars Rows = "))
sy = input("Symbol for F Star Pattern = ")
FPattern(row, sy)
Enter Alphabet F of Stars Rows = 10
Symbol for F Star Pattern = @
@@@@@@@@@@@
@
@
@
@
@@@@@@@
@
@
@
@
Also Read