-1
columns = input("Enter number of columns: ")
rows = input("Enter number of rows: ")

for r in range(rows):
    if r == 0 or r == rows - 1:
        print('* ' * columns)
    else:
        print('* ' + '  ' * (columns - 2) + '* ')
Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219

1 Answers1

0
rows = input("Enter number of rows: ")

You have maybe used languages as C/C++, in which you do something like:

std::cin >> var; // with var being an int

But in Python you have to do a casting, like this...

rows = input("Enter number of rows: ")
rows = int(rows)

...before using it as an integer.

FLAK-ZOSO
  • 3,873
  • 4
  • 8
  • 28