Creating a list of Exponents

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alfredo ramirez

    #1

    Creating a list of Exponents

    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
  • Glenton
    Recognized Expert Contributor
    • Nov 2008
    • 391

    #2
    Perhaps you can show us your code.

    In the meantime, perhaps the following interactive session will help you:
    Code:
    >>> v=input("Biggest number: ")
    Biggest number: 1000000
    >>> i=1
    >>> while i<=v:
    	print i
    	i=i*2
    
    	
    1
    2
    4
    8
    16
    32
    64
    128
    256
    512
    1024
    2048
    4096
    8192
    16384
    32768
    65536
    131072
    262144
    524288
    >>>

    Comment

    Working...