I am trying to create pipeline that converts a number to its Ones' complement number, for example (8)
1234 -> 7654
83743 -> 05145
I tried to create something in this style but I can't figure out how to build the pipeline correctly.
int(''.join((my_number(lambda y: 8-y, list(my_number)))))
Error
TypeError: 'int' object is not callable
The following should work:
int(''.join([str(8-int(y)) for y in str(my_number)]))
Example:
my_number=1258437620
Output:
>>> int(''.join([str(8-int(y)) for y in str(my_number)]))
7630451268