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 point) Responses print("Compound interest is", Amount + principal) print("Compound interest is", Amount + principal) Amount = principal * (pow((1 + rate / 100), time)) Amount = principal * (pow((1 + rate / 100), time)) rate = 10.25 rate = 10.25 principal = 10000

3 answers

The code that should be placed into a function is:

```python
def calculate_compound_interest():
principal = 10000
rate = 10.25
time = 5
Amount = principal * (pow((1 + rate / 100), time))
Total = Amount + principal
print("Compound interest is", Total)

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

This function calculates and prints the compound interest for two scenarios: one with a principal of $10,000, a rate of 10.25% and a time of 5 years; and another with a principal of $10,000, a rate of 5.25% and a time of 10 years.
Which of the following correctly pairs an example with event- or sequential-driven programming?(1 point) Responses event-driven programming – a messaging application that lets users call people sequential-driven programming – an application that displays all the letters for kids to learn event-driven programming – a messaging application that lets users call people sequential-driven programming – an application that displays all the letters for kids to learn event-driven programming – a music application that allows users to create playlists sequential-driven programming – a shopping list application that users can add and remove items from event-driven programming – a music application that allows users to create playlists sequential-driven programming – a shopping list application that users can add and remove items from event-driven programming – an application that displays all the letters for kids to learn sequential-driven programming – a music application that allows users to create playlists event-driven programming – an application that displays all the letters for kids to learn sequential-driven programming – a music application that allows users to create playlists event-driven programming – a shopping list application that users can add and remove items from sequential-driven programming – a messaging application that lets users call people
event-driven programming – a messaging application that lets users call people

sequential-driven programming – an application that displays all the letters for kids to learn