angelcruces7885 angelcruces7885
  • 08-11-2017
  • Computers and Technology
contestada

Write a program that responds to a positive integer passed on the command line with the number of bits needed to express that number in binary.

Respuesta :

rsmith6559
rsmith6559 rsmith6559
  • 09-11-2017
You may want to rephrase the output.

```
#!/usr/local/bin/python3

### Written for Python version 3! ###

import sys

num = int( sys.argv[ 1 ] )
exp = 0

while( num > 2**exp ):
    exp += 1

print( "It takes %d bits to get to the center of a Tootsie Roll" % exp )

exit( 0 )
```


Answer Link

Otras preguntas

Use a transformation to solve the equation. k/-4 = - 0.8 A. k = –3.2 B. k = –0.2 C. k = 0.2 D. k = 3.2
Which of the following tactics was not used by trade unions? A. organizing workers B. collective bargaining C. lockouts D. strikes
What is the solution of log3x − 12 729 = 6? x = −5 x = −3 x = 3 x = 5 *"3x- 12" is next to log, but it's in the bottom, like an exponent, but instead of it bei
for the equation y=7x+3 the value of X changes from 1 to 2
How to solve the quadratic equation by factoring x^{2}+4x+3=0
find the zeros of f(x)=x squared-x
Joanie wrote a letter that was 1 1/4 pages long. Katie wrote a letter that was 3/4 page shorter than Joanie's letter. How long was Katie's letter?
Which of the following is the climax of "The Circuit"? A. the narrator and his brother working in the field with their father B. the family working together
Abdul runs 6 miles in 50 minutes. At the same rate, how many miles would he run in 35 minutes?
In circle X chords AB and CD are congruent and AB is 9 units from X. Find the distance from CD to X. I need help with the steps I have no idea of how to do it.