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

Question 3 Which of the following is a group of states (or city-states) under a single authority? O empire O cuneiform O nomad O code of hammurabi
2. An organization's products and services are the driving force in accomplishing its purpose. A. True B. False
Gershon lives 3 10 mile from the soccer fields. How far does Gershon walk if he walks from home to the soccer fields and back home? How many miles did he walk
HELP MEE The sciences used to study the land bridge include ____________ a. climatology. b. environmental science. c. paleontology. d. all of the above. Please
Sam is 5 feet tall. The expression 0.5m+60 can be used to calculate his height in inches if he grows an average of 0.5 inch each month. How tall will Sam be in
Find the distance between the points (5, 3) and (7,6).
19. Voy al para ir de compras. centro comercial restaurante O templo baño
Explain how plastic can be both beneficial and detrimental at the same time.
what body of water did Caesar cross on his campaign to Spain​
What is the graph of g?