Write a simple Python program that displays the following powers of 2, one per line: 2¹ , 2², 2³ , 2^4, 2^5 , 2^6 , 2^7 , 2^ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a simple Python program that displays the following powers of 2, one per line: 2¹ , 2², 2³ , 2^4, 2^5 , 2^6 , 2^7 , 2^

6th Feb 2017, 9:42 PM
Atitebi Jacob
Atitebi Jacob - avatar
6 Answers
+ 20
for x in range(1, 10): print("2 ^", x, "=", 2**x)
6th Feb 2017, 10:01 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
for i in range(1, 10): print(2**i)
6th Feb 2017, 9:59 PM
Mario L.
Mario L. - avatar
+ 3
print ("What power of two? ") x = int (input()) print ("Two to the power of", x, "is", 2**x)
7th Feb 2017, 8:05 PM
merkrafter
0
for i in range(1, 10): print(2**i)
7th Feb 2017, 12:29 AM
DerpyOmnister
DerpyOmnister - avatar
0
Please help me answer the question below. Write a Python program that allows the user to enter any integer value, and displays the value of 2 raised to that power. Your program should function as shown below. What power of two? 10 Two to the power of 10 is 1024
7th Feb 2017, 6:02 AM
Atitebi Jacob
Atitebi Jacob - avatar
- 1
Thank to you all
7th Feb 2017, 5:54 AM
Atitebi Jacob
Atitebi Jacob - avatar