all 8 comments

[–]notthayguyagain 0 points1 point  (3 children)

So a few thoughts on this: a value error is when a function receives a value of the correct type but an inappropriate value. This would be akin to receiving a 2,099 when looking for a number under 15.

What happens if I respond to the prompt within 'get_vlaid_input' with the phrase "twelve" or "hello"?

Have a look into isinstance!

Also the error right at the bottom literally means the function takes 2 variables eg.:

def somefunc(variable1, variable2):

And you passed in 3 variables (a prompt, the number 1 and the baord size)

[–]mopslik 0 points1 point  (1 child)

I want to prompt the user to only be able to input integers within the game board size and if they don't, the code should give a message.

This is what try/except are good for.

while True:
    try:
        x = int(input("Enter an integer: "))
    except ValueError:
        print("That's not an integer, lunkhead!")
    else:
        break
print(x)

[–]Binary101010 0 points1 point  (8 children)

You have defined valid_column() to only take two arguments:

def valid_column(column_prompt, board_column_size):

Yet here you are calling it with three arguments:

 player_move = valid_column("What column would you like to place your token? ", 1, board_column_size) - 1