Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44 lines (32 sloc)
919 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'Avinash' | |
# Python3 program to print alphabet pattern O | |
# * * * * * * | |
# * * | |
# * * | |
# * * | |
# * * | |
# * * | |
# * * | |
# * * * * * * | |
def print_pattern(n): | |
for row in range(n): | |
for column in range(n): | |
if ( | |
# first row | |
(row == 0 and (column != 0 and column != n-1)) or | |
# last row | |
(row == n - 1 and (column != 0 and column != n-1)) or | |
# first column | |
(column == 0 and (row != 0 and row != n-1)) or | |
# last column | |
(column == n -1 and (row != 0 and row != n-1)) | |
): | |
print("*", end=" ") | |
else: | |
print(" ", end=" ") | |
print() | |
size = int(input("Enter a size:\t")) | |
if size < 8: | |
print("Enter a size minumin of 8") | |
else: | |
print_pattern(size) |