Ask Question
9 October, 21:24

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.

+2
Answers (1)
  1. 9 October, 22:20
    0
    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)

    '''
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “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 ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers