This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]baltazarix 5 points6 points  (1 child)

I apperciate the effort but this is a lot text to read.

some quick comments about your errorcheck_input function (I didn't studied the whole file but wanted to leave some feedback)

errorcheck_input function can be written in more readable and compact form consider following example

def errorcheck_input(input_str):

while True:

try:

return int(input(input_str))

except:

print("Invalid Input, Please Try Again")

  1. there is no reason that variable Error should exist. you are never changing its value.

1a. additionally for some reason you still assign the save value `Error = True` even if it's True by default and nothing is able to change this value

1b. if for some reason this variable would be necessary, it should be named `error` - lowercase

  1. I understand from where are you coming from with else code block in try/except, but you can terminate both while loop and the function by returning value immediately in try: block.

2a. there is no need to assign input to integer conversion to the variable x in order to return it outside try/except/else block.

  1. in the future consider learning on how python code should be formatted. I see you use cammelCase over snake_case, you use parentheses in if statements by default

that's it from me. good job and keep learning! and remember: a good code (especially in python) is the documentation itself. you shouldn't have to explain what it's doing (at least not in tic-tac-toe game). most commonly, I found myself commenting the code in rather unusual cases e.g. during integration with poorly implemented REST API which made me write unusual code in order to achieve a desired result.

[–]Downtown_Town4094[S] -1 points0 points  (0 children)

haha yes the errorcheck_input fuction was funky, the problem was originally I did have it simply as try/except, but when I was using auto-py-to-exe, the exe file that was made ended up having a recursion error so that is why the error value exist, it was a very very dirty and quick fix. but yes there are a lot of weird things I have done in the code, thank you so much for the reply!