A group of students is arguing about which are better terms for a loan with compound interest-longer time with lower interest, or shorter time with higher interest. They decide to write a program to calculate each total so that they can compare between both the conditions:

principal = 10000
rate = 10.25
time = 5
Amount = principal * (pow((1 + rate / 100), time))
Total = Amount + principal
print("Compound interest is", Amount + principal)
rate = 5.25
time = 10
Amount = principal * (pow((1 + rate / 100), time))
print("Compound interest is", Amount + principal)

Which code should be placed into a function?

1.print("compound interest is", Amount + principal)

2.Amount = principal * (pow((1 + rate / 100), time))

3. principal = 10000

4.rate = 10.25

The code that should be placed into a function is code number 2:

Amount = principal * (pow((1 + rate / 100), time))