Ask 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 binary.

+1
Answers (1)
  1. 24 November, 15:37
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers