Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Nested Loops and Alignment [8/10]

The function pow can be used to raise a number to the given power.

The function pow returns a value of type num. Therefore, the result of function pow can be aligned with getter function .al.

The function pow accepts two arguments. In other words, the function pow has two parameters. The first parameter is called the base and the second parameter is called the exponent. Both parameters are of type num.

Exercise:

The output of this program is not perfectly aligned. There are two issues. Correct both of them.

Solution Part 1

print "pow(2,",i.pad(2),") = ";

Solution Part 2

print pow(2,i).al(7,0);

Loading...