Advertisement
Guest User

Python 2 to the power of n

a guest
Apr 28th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. print("This program will calculate 2 to the power of n")
  2. print("How many powers do you want to calculate?")
  3. loop = int(input("n = "))
  4. value = 0
  5.  
  6. print()
  7. for i in range(0, loop + 1):
  8.     value = 2 ** i
  9.     print("2 to the power",i,"is equal",value)
  10.  
  11. input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement