Mega Code Archive

 
Categories / Python Tutorial / Statement
 

The while Statement

count = 0 x = 10 while x > 0:     x = x // 2            # truncating division     count += 1 print "The approximate log2 is", count