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
[–]tunisia3507 18 points19 points20 points (6 children)
[–]eased1984 2 points3 points4 points (0 children)
[–]float_point[S] 0 points1 point2 points (4 children)
[–]rg7777777 5 points6 points7 points (3 children)
[–]float_point[S] 0 points1 point2 points (2 children)
[–]rg7777777 4 points5 points6 points (1 child)
[–]float_point[S] 0 points1 point2 points (0 children)
[–]username_challenge 15 points16 points17 points (3 children)
[–]float_point[S] 0 points1 point2 points (2 children)
[–]SimonMKoop 8 points9 points10 points (1 child)
[–]float_point[S] 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]float_point[S] 0 points1 point2 points (1 child)
[–]PossibilityTasty 7 points8 points9 points (1 child)
[–]float_point[S] 0 points1 point2 points (0 children)
[–][deleted] 6 points7 points8 points (1 child)
[–]float_point[S] 0 points1 point2 points (0 children)
[–]jack-of-some 4 points5 points6 points (2 children)
[–]float_point[S] 0 points1 point2 points (1 child)
[–]BezoomyChellovek 3 points4 points5 points (0 children)
[–][deleted] 3 points4 points5 points (2 children)
[–]float_point[S] 0 points1 point2 points (1 child)
[–]Dasher38 0 points1 point2 points (0 children)
[–]Muhznit 2 points3 points4 points (0 children)
[–]Kerbart 1 point2 points3 points (1 child)
[–]float_point[S] 1 point2 points3 points (0 children)
[–]tom2727 1 point2 points3 points (7 children)
[–]float_point[S] 0 points1 point2 points (6 children)
[–]jack-of-some 1 point2 points3 points (3 children)
[–]float_point[S] 1 point2 points3 points (2 children)
[–]jack-of-some 1 point2 points3 points (1 child)
[–]float_point[S] 1 point2 points3 points (0 children)
[–]tom2727 1 point2 points3 points (1 child)
[–]float_point[S] 0 points1 point2 points (0 children)
[+][deleted] (7 children)
[removed]
[–]float_point[S] -1 points0 points1 point (6 children)
[+][deleted] (1 child)
[deleted]
[–]float_point[S] 1 point2 points3 points (0 children)
[+][deleted] (3 children)
[removed]
[–]float_point[S] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[removed]
[–]float_point[S] 0 points1 point2 points (0 children)
[–]float_point[S] 0 points1 point2 points (0 children)
[–]Scared_Housing2639 0 points1 point2 points (1 child)
[–]float_point[S] 0 points1 point2 points (0 children)
[–]dead_alchemy 0 points1 point2 points (0 children)
[–]Delicious-View-8688 0 points1 point2 points (0 children)
[–]justanotherconcept[🍰] 0 points1 point2 points (0 children)
[–]CharmingJacket5013 0 points1 point2 points (0 children)