So, i create several strings in variables and print out portions of your code like (excuse the global):
str1 = 'hello Mabel'
str2 = 'Hi ya Fred'
str3 = 'I am a string'
str4 = 'so am i'
str5 = 'how about some food'
str6 = 'Not right now'
str7 = 'yubba dubba do'
c = 5
dboard = [str1, str2, str3, str4, str5, str6, str7]
def columncheck(c):
global dboard
x = 5
pos = False
while pos != True:
print('x: {}'.format(x))
y = dboard[x]
x1 = 4 * c - 1
print(f'y: {y}')
print(f'x1: {x1}')
print(f'y[x1]: {y[x1]}')
if dboard[x][(4*c)-1] == " ":
pos = True
elif dboard[x][(4*c)-1] != " ":
x -= 1
print('x: {}'.format(x))
print('x: {}'.format(x))
return x
column = int(input('Choose a column: '))
columncheck(column)
and get some results:
Output:
Choose a column: 2
Traceback (most recent call last):
File "M:/python/forum/Old/junk5.py", line 32, in <module>
columncheck(column)
File "M:/python/forum/Old/junk5.py", line 22, in columncheck
print(f'y[x1]: {y[x1]}')
IndexError: string index out of range
x: 5
y: Not right now
x1: 7
y[x1]: h
x: 4
x: 4
y: how about some food
x1: 7
y[x1]: u
x: 3
x: 3
y: so am i
x1: 7
and then the crash (traceback occurs after x1: 7)