Question: In python, Generate a table showing powers of 2 with two columns using a while loop and the escape sequence (t) . t is an

In python,

Generate a table showing powers of 2 with two columns using a while loop and the escape sequence (\t) . \t is an escape sequence in Python that creates a horizontal tab. Your program should output a sequence of values in the left column, and the number 2 raised to the power of that value in the right column. The first column shows numbers 0-12 and the right column shows 2 raised to the 0-12. Alternatively you may prompt the user to enter the range for the left column.

Expected Output:

0 1 1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024 11 2048 12 4096

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!