"Ascending" means starting low and going up.
"Descending" means starting high and coming down.
To accomplish this without using a loop,
we can use math on a string.
Example:
print("apple" * 8)
Output:
appleappleappleappleappleappleappleapple
In this example,
the multiplication by 8 actually creates 8 copies of the string.
So that's the type of logic we want to apply to our problem.
<span>def powersOfTwo(number):
if number >= 0:
return print("*" * 2**number)
else:
<span>return
Hmm I can't make indentations in this box,
so it's doesn't format correctly.
Hopefully you get the idea though.
We're taking the string containing an asterisk and copying it 2^(number) times.
Beyond that you will need to call the function below.
Test it with some different values.
powersOfTwo(4) should print 2^4 asterisks: ****************</span></span>
Answer:
0.03
Explanation:
3e-2 is in scientific notation, also known as standard form. Used to write large or small numbers in another way. In the number 3e-2, the numbers are defined as follows:
3 = coefficient
e = 10 to the power of
-2 = exponent
The scientific notation 3e-2 is same as 3 x 10^-2 or 3 x 10-2. Thus, to get the answer to 3e-2 as a decimal, we multiply 3 by 10 to the power of -2.
= 3e-2
= 3 × 10-2
= 0.03