Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q3 Answer in Python. Use the code given in the answer when neccessary and follow all instructions. Problem #4: Banking Balance . Write a program

image text in transcribedimage text in transcribed

Q3

image text in transcribed

Answer in Python. Use the code given in the answer when neccessary and follow all instructions.

Problem #4: Banking Balance . Write a program that will calculate interest on a bank deposit and add that interest to the account's balance. Assume the initial deposit is $10,000 (year 0). Your program should reflect the following pseudocode description of this logic: . Repeat the following steps while the balance is less than $20,000. Add 1 to the year value. Compute the interest as balance x 0.05 (i.e., 5 percent interest). Add the interest to the balance. . When the loop finishes, print the final year balance and the number of years it took to reach $20,000 (assuming no withdrawals). In your output, print appropriate labels (text) to make clear what the output values refer to. Round the final-year balance in the output to 2 decimal places. In [1]: The final year balance is $ 20789.28 The number of years it took to reach $20,000 is 15 years Problem #5: Find the largest number Write a program that prints the highest number in the list object named: numList. Note: do not use max() as this is an exercise to practice looping. Note: in a later lesson we will look more closely at the list data structure. In short: a list instance (list object) is a sequence (ordered set) of elements (also called items). Notice the elements of a list are 'wrapped' within []. In [2]: numList = [33, 55, 22, 11, 88, 44, 33, 22] # this is a list (of integers) The ATLForecast.dat file contains the minimum forecast temperature for the 14 days in Atlanta (we will assume that we are presently in late summer). Write a program that loops through ALL the values within this file and tests whether each value is more or less than 64 or 65 degrees, as shown in the example output below. Note: at this stage, do not be concerned about what-is numpy (all will be explained in a later lesson). We will use the loadtext function in this package to load the text data. In [12] : import numpy as np temperatureData = np.loadtxt('ATLForecast.dat') print("temperatureData= ", temperatureData) day = 1 # we will use a numpy function to load the dat file # ensure this file is in the same directory as this notebook # display the contents of the imported data temperatureData= [70. 69. 71. 66. 60. 61. 63. 65. 67. 66. 65. 65. 64. 63. ] Atlanta's forecast low in 1 days time is equal to or more than 65 degrees Atlanta's forecast low in 2 days time is equal to or more than 65 degrees 2 Atlanta's forecast low in 3 days time is equal to or more than 65 degrees Atlanta's forecast low in 4 days time is equal to or more than 65 degrees ? Atlanta's forecast low in 5 days time is less than 65 degrees Atlanta's forecast low in 7 days time is less than 65 degrees Atlanta's forecast low in 6 days time is LESS than 65 degrees LESS Atlanta's forecast low in 8 days time is equal to or more than 65 degrees Atlanta's forecast low in 9 days time is equal to or more than 65 degrees Atlanta's forecast low in 10 days time is equal to or more than 65 degrees Atlanta's forecast low in 11 days time is equal to or more than 65 degrees Atlanta's forecast low in 12 days time is equal to or more than 65 degrees Atlanta's forecast low in 13 days time is LESS than 65 degrees Atlanta's forecast low in 14 days time is LESS than 65 degrees

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

Students also viewed these Databases questions

Question

what is the most common cause of preterm birth in twin pregnancies?

Answered: 1 week ago

Question

Which diagnostic test is most commonly used to confirm PROM?

Answered: 1 week ago

Question

What is the hallmark clinical feature of a molar pregnancy?

Answered: 1 week ago