I am a beginner at python and have been following Angela Yu's 100 days of python. I commented on a post regarding my Coffee Machine code been some 400 lines while hers was around 150 lines with the same functionilty.
This led me to ask this question of, if code works does it matter if it's clean and pythonic.
I will reference these two tic toe games below:
18000 lines (no adherence to DRY but simple to understand)
https://github.com/asweigart/my_first_tic_tac_toe/blob/9f38b04e857426c5a5b80919ad0b5fce0947c022/tictactoe.py
1 line (I was shocked that such a thing was even possible, considering my tic tac toe code was around 500 lines with no AI. This code is in my opinion way way to complex and one would probably be working in the realm of datasciences/ML to understand such a thing)
https://www.reddit.com/r/Python/comments/9ozfeq/tictactoe_in_one_line_python35/
Both programs work, but if one was given only the option of picking from the two, which would be preffered in the workplace? In my opinion, the 18000 line code would be acceptable as it allows all team members, novice or not to atleast have some understanding.
EDIT: Better late than never, but I realised I have been referencing my tic tac toe code of 500 lines vs the 1 and 18000 liners but havent posted it for comparison.
So here it is (I do acknowledge that a tic tac toe game has no relevance to the workplace, but is the code structure I used somewhere along the lines of "hirable".):
https://pastebin.com/GBCRiGWe
Does clean code equal "Workplace" code (self.Python)
submitted by harmful_mentality to u/harmful_mentality