I'm pretty new so sorry if this is a dumb question.
I watching some python learning videos and was trying to do some different things using the same concepts. In the video, they demonstrated making a grid using user inputed symbols like this:
rows = int(input("How many rows? "))
columns = int(input("How many columns? "))
symbols = input("Please put in a symbol: ")
for i in range(rows):
for j in range(columns):
print(symbol, end="")
print()
From this, I was thinking, "Hey can I make python draw a box using user inputed number of rows and columns?"
I tried making this code:
columns = int(input("How many columns? "))
for i in range(rows):
for j in range(columns)[0]:
print("|", end="")
for j in range(columns):
print("_", end="")
for j in range(columns)[-1]:
print("|", end="")
print()
This didn't run because it says int object is not iterable; however, I'm not sure why? Ranges are able to be used in for loops, but is it not possible to call on a specific value in the range to perform the for loop?
My reasoning for my code is that whenever a number in the range of the column is 0, then I want it to print "|" to make the sides of the box.