Binary digits: Difference between revisions
Content deleted Content added
→Custom functions: Updated output to conform with task description tests. |
|||
Line 2,980: | Line 2,980: | ||
def main(): |
def main(): |
||
'''Test''' |
'''Test''' |
||
print('Mapping showBinary over integer list:') |
|||
print(unlines(map( |
|||
showBinary, |
|||
[5, 50, 9000] |
|||
))) |
|||
print(tabulated( |
print(tabulated( |
||
' |
'\nUsing showBinary as a display function:' |
||
)(str)( |
)(str)(showBinary)( |
||
lambda x: x |
|||
)([5, 50, 9000])) |
)([5, 50, 9000])) |
||
Line 3,049: | Line 3,055: | ||
main()</lang> |
main()</lang> |
||
{{Out}} |
{{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 |
5 -> 101 |
||
50 -> 110010 |
50 -> 110010 |