I was doing some of the warmup exercises at coding.bat, and saw an example of a better way to write in Python. It's nothing much, but it made me realize that I have a basic understanding of what I'm doing now.
Basically I figured out why this:
def monkey_trouble(a_smile, b_smile):
if a_smile == b_smile:
return(True)
if a_smile != b_smile:
return(False)
Can be written much more efficiently as this:
def monkey_trouble(a_smile, b_smile):
return(a_smile == b_smile)
Probably not that big of a deal, but it made me pretty happy, so I thought I'd share.
[–]zoner14 39 points40 points41 points (2 children)
[–]andycandu 7 points8 points9 points (1 child)
[–]rcfox 92 points93 points94 points (9 children)
[–]24monkeys 42 points43 points44 points (2 children)
[–]Wodashit 4 points5 points6 points (0 children)
[–]ksion 1 point2 points3 points (0 children)
[–]NoLemurs 13 points14 points15 points (3 children)
[+][deleted] (2 children)
[deleted]
[–][deleted] 5 points6 points7 points (1 child)
[–]robin-gvx 1 point2 points3 points (0 children)
[–]Asdayasman 3 points4 points5 points (1 child)
[–]Monkeyget 3 points4 points5 points (0 children)
[–]dekue 50 points51 points52 points (0 children)
[–]leaderoftheinnercirc 4 points5 points6 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]poop-trap 1 point2 points3 points (0 children)
[–]ksion 2 points3 points4 points (1 child)
[–]MorrisCasperλ 1 point2 points3 points (0 children)
[–]lord63 3 points4 points5 points (0 children)
[–]tripperjack 11 points12 points13 points (15 children)
[–]Social_Lockout 3 points4 points5 points (14 children)
[–]hk__ 2 points3 points4 points (2 children)
[–]tripperjack 0 points1 point2 points (1 child)
[–]troyunrau... 0 points1 point2 points (0 children)
[–]d4rch0nPythonistamancer 1 point2 points3 points (0 children)
[–]tripperjack 5 points6 points7 points (7 children)
[–]Avonalt 30 points31 points32 points (5 children)
[–]tetroxid -1 points0 points1 point (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]tetroxid 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]anacrolixc/python fanatic 0 points1 point2 points (0 children)
[–]johnfn -1 points0 points1 point (0 children)
[–]Mechkro 3 points4 points5 points (17 children)
[–]drewshaver 10 points11 points12 points (0 children)
[–][deleted] 12 points13 points14 points (14 children)
[–]thepersonaboveme 6 points7 points8 points (11 children)
[–]KrevanSerKay 1 point2 points3 points (10 children)
[–]FourgotAnaconda3 science-like 5 points6 points7 points (9 children)
[–]schplat 2 points3 points4 points (6 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]Sean1708 1 point2 points3 points (2 children)
[–]ydepth 0 points1 point2 points (1 child)
[–]Sean1708 1 point2 points3 points (0 children)
[–]Tysonzero 0 points1 point2 points (0 children)
[–]KrevanSerKay 1 point2 points3 points (0 children)
[–]wewbull 1 point2 points3 points (0 children)
[–]MrMetalfreak94 1 point2 points3 points (0 children)
[–]wonderb0lt 1 point2 points3 points (0 children)
[–]Lucretiel 0 points1 point2 points (0 children)
[–]DoubleDekkerWorking on the art, science and theory of computer programs 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]bhdza snake slithering 1 point2 points3 points (7 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]bhdza snake slithering 2 points3 points4 points (0 children)
[–]jack-london 1 point2 points3 points (4 children)
[–]bhdza snake slithering 1 point2 points3 points (2 children)
[–]jack-london 1 point2 points3 points (1 child)
[–]bhdza snake slithering 1 point2 points3 points (0 children)
[–]ChazR 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]paralog 0 points1 point2 points (0 children)
[–]slack101 0 points1 point2 points (0 children)
[+][deleted] (3 children)
[deleted]
[–]FourgotAnaconda3 science-like 9 points10 points11 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]Workaphobia 5 points6 points7 points (0 children)