By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,034 Members | 2,000 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,034 IT Pros & Developers. It's quick & easy.

Creating a list of Exponents

P: n/a
Hi, I am trying to create a program the displays a chart showing the powers of 2, from 0 up to a number requested by the user.

when I try to make this I get an error message saying: unsupported operand types for **, pow(): int, lists
Oct 23 '10 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 391
Perhaps you can show us your code.

In the meantime, perhaps the following interactive session will help you:
Expand|Select|Wrap|Line Numbers
  1. >>> v=input("Biggest number: ")
  2. Biggest number: 1000000
  3. >>> i=1
  4. >>> while i<=v:
  5.     print i
  6.     i=i*2
  7.  
  8.  
  9. 1
  10. 2
  11. 4
  12. 8
  13. 16
  14. 32
  15. 64
  16. 128
  17. 256
  18. 512
  19. 1024
  20. 2048
  21. 4096
  22. 8192
  23. 16384
  24. 32768
  25. 65536
  26. 131072
  27. 262144
  28. 524288
  29. >>> 
Oct 25 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.