Ask Question
18 January, 04:57

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.

+1
Answers (1)
  1. 18 January, 05:08
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers