-log2() is a python function which is predefined in math library and use for find the value of log of base 2.
Syntax-
math.log2(num)
Example-
number is 16
log2(16) will give 4.0
number is 64
log2(64) will give 6.0
number is 1024
log2(1024) will give 10.0
program-
import math
print("Enter any number")
a=int(input())
print("Log2 of number is "+str(math.log2(a)))
print("Enter another number")
a=int(input())
print("Log2 of number is "+str(math.log2(a)))
Enter any number
16
Log2 of number is 4.0
Enter another number
1024
Log2 of number is 10.0
Enter any number
34
Log2 of number is 5.087462841250339
Enter another number
546
Log2 of number is 9.092757140919852