ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/learning/Mark/power.py
Revision: 8
Committed: Sat May 5 04:21:19 2012 UTC (13 years, 10 months ago) by ninoborges
Content type: text/x-python
File size: 248 byte(s)
Log Message:
Initial Import

File Contents

# User Rev Content
1 ninoborges 8 L = [1, 2, 4, 8, 16, 32, 64]
2    
3     X = 5
4    
5    
6    
7     #found = i = 0
8    
9     while not found and i < len(L):
10     if 2 ** X == L[i]:
11     found = 1
12     else:
13     i = i+1
14    
15    
16    
17     if found:
18    
19     print 'at index', i
20    
21     else:
22    
23     print X, 'not found'