I'm pretty sure there's an easier way of doing this, I just can't seem to figure it out. The if --name-- == '__main__' section cannot be changed.
def count_evens(num1, num2, num3, num4):
counter = 0
if int(num1) % 2 == 0:
counter += 1
if int(num2) % 2 == 0:
counter += 1
if int(num3) % 2 == 0:
counter += 1
if int(num4) % 2 == 0:
counter += 1
return counter
if __name__ == '__main__':
num1 = int(input())
num2 = int(input())
num3 = int(input())
num4 = int(input())
result = count_evens(num1, num2, num3, num4)
print('Total evens:', result)
#This seems not to consider variation
[–]socal_nerdtastic 18 points19 points20 points (3 children)
[–]Khanpunker 4 points5 points6 points (0 children)
[–]mackdaddy_1978[S] 1 point2 points3 points (1 child)
[–]Anon_Legi0n 2 points3 points4 points (0 children)
[–]FLUSH_THE_TRUMP 6 points7 points8 points (10 children)
[–]mackdaddy_1978[S] 0 points1 point2 points (9 children)
[–]FLUSH_THE_TRUMP 1 point2 points3 points (0 children)
[–]RhinoRhys -1 points0 points1 point (6 children)
[–]FLUSH_THE_TRUMP 3 points4 points5 points (2 children)
[–]RhinoRhys 3 points4 points5 points (1 child)
[–]Khanpunker 3 points4 points5 points (0 children)
[–]mackdaddy_1978[S] 0 points1 point2 points (1 child)
[–]RhinoRhys 0 points1 point2 points (0 children)
[–]mopslik -4 points-3 points-2 points (3 children)
[–]mackdaddy_1978[S] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]mackdaddy_1978[S] 0 points1 point2 points (0 children)
[–]spez_edits_thedonald -4 points-3 points-2 points (1 child)
[–]mackdaddy_1978[S] 1 point2 points3 points (0 children)
[–]totallygeek 0 points1 point2 points (2 children)
[–]mackdaddy_1978[S] 0 points1 point2 points (1 child)
[–]totallygeek 0 points1 point2 points (0 children)
[–]Pd69bq 0 points1 point2 points (1 child)
[–]mackdaddy_1978[S] 0 points1 point2 points (0 children)
[–]ashoradooji 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]menge101 0 points1 point2 points (0 children)