Problem: Create a code that allows people to learn about exponents.
The task is to write a code which takes an integer number as an input and returns the values ranging from that of 2(two) raised to power 0(zero) to 2(two) raised to power n(the number specified in input)
Input: Input contains the number 'n' for which all the values are returned from power of 2 from 0 to n.
Output: Output contains the values ranging from 2(two) raised to power 0(zero) to 2(two) raised to power n(input) separated by a comma.
Note: For testcases with negative number as input, 2 raise to power 0 will be considered as 1.0 instead of 1 whereas for other negative powers the trailing zeros in output will be truncated like 0.50 is 0.5 , 0.25 is 0.25, 0.1250 is 0.125
Constraints: -1000 ≤ n ≤ 1000
Sample Input: 5
Sample Output:
1,2,4,8,16,32
n = int(input())
n += -1 if n < 0 else 1
if n < 0:
print('1.0,' + ','.join([str(2**i).rstrip('0') for i in range(-1, n, -1)]))
else:
print(','.join([str(2**i) for i in range(n)]))