print("Please, note: The first number is Yes (0), No (1)") print("The second number is A (0), B (1)") print("The third number is 0 for the first table and 1 for the second.") print("") scoreDifference = 0 for u in range(8): inputA = bin(u).split('b')[1] inputA = int(inputA) for i in range(8): inputB = bin(i).split('b')[1] inputB = int(inputB) #For A if inputA > 99: A1 = 1 provA2 = inputA - 100 else: A1 = 0 provA2 = inputA if provA2 > 9: A2 = 1 A3 = provA2 -10 else: A2 = 0 A3 = provA2 #For B if inputB > 99: B1 = 1 provB2 = inputB - 100 else: B1 = 0 provB2 = inputB if provB2 > 9: B2 = 1 B3 = provB2 -10 else: B2 = 0 B3 = provB2 scoreDifference = 0 # Game start if A1 != B1: if A1 == 1: scoreDifference = scoreDifference +9 else: scoreDifference = scoreDifference -9 if A3 == 1 and B3 == 1: if scoreDifference > 0: scoreDifference = scoreDifference -7 if scoreDifference == 0: scoreDifference = scoreDifference if scoreDifference < 0: scoreDifference = scoreDifference +7 if A3 == 1 and B3 != 1: if scoreDifference > 0: scoreDifference = scoreDifference -12 if scoreDifference == 0: scoreDifference = scoreDifference -5 if scoreDifference < 0: scoreDifference = scoreDifference +5 if B3 == 1 and A3 != 1: if scoreDifference > 0: scoreDifference = scoreDifference +12 if scoreDifference == 0: scoreDifference = scoreDifference +5 if scoreDifference < 0: scoreDifference = scoreDifference -5 if A3 == 0: if (A2 != B2) and A2 == 1: scoreDifference = scoreDifference -2 if (A2 != B2) and B2 == 1: scoreDifference = scoreDifference +2 if B3 == 0: if (A2 != B2) and A2 == 1: scoreDifference = scoreDifference -2 if (A2 != B2) and B2 == 1: scoreDifference = scoreDifference +2 print ("For input A: " + str(inputA) + " and For input B: " + str(inputB)) print ("The score difference is: " + str(scoreDifference)) print ('')
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question