Binary digits: Difference between revisions

→‎Custom functions: Updated output to conform with task description tests.
(→‎Custom functions: Updated output to conform with task description tests.)
Line 2,980:
def main():
'''Test'''
 
print('Mapping showBinary over integer list:')
print(unlines(map(
showBinary,
[5, 50, 9000]
)))
 
print(tabulated(
'Binary\nUsing digitsshowBinary foras non-negativea integersdisplay function:'
)(str)(strshowBinary)(
showBinarylambda x: x
)([5, 50, 9000]))
 
Line 3,049 ⟶ 3,055:
main()</lang>
{{Out}}
<pre>Mapping showBinary over integer list:
<pre>Binary digits for non-negative integers:
101
110010
10001100101000
 
Using showBinary as a display function:
5 -> 101
50 -> 110010
9,659

edits