aboutsummaryrefslogtreecommitdiff
path: root/challenge-192/eric-cheung/python/ch-1.py
blob: 8d5c289448b2e868fbf616bc4cdee65e1fd8d100 (plain)
1
2
3
4
5
6
7
8
9
10
## nInputNum = 5  ## Example 1
nInputNum = 4  ## Example 2
## nInputNum = 6  ## Example 3

strBinFormat = bin(nInputNum)[2:]
strBinFlipFormat = "".join(["0" if strCharLoop == "1" else "1" for strCharLoop in strBinFormat])
nOuputDecFormat = int(strBinFlipFormat, 2)

print (str(nOuputDecFormat))