//Python //loop
Posted: Sun Jul 03, 2022 11:24 am
//Python
//loop
For this lab, write a python program so it will continuously be asking user for inputs to calculate the interest earned until the user enters number 0 (zero) in principle. Once the user enters any number less or equal to 0 in principle, the program will exist. Submit your python program and screenshot of your program output. HINT: Use while loop to ask user for inputs. Assuming the following variables: ● p holds the initial principle balance r holds the annual interest rate ● n holds how many times the interest compound in a year • t holds how many years will the acco earn interest To calculate ending total balance: ** • total = p*(1 + float( r / 100) / n) (n* t) interest total - p
Enter the starting principal, 0 to quit: 12000 Enter the annual interest rate : 1.95 How many times per year is the interest compounded? 365 For how many years will the account earn interest? 2 At the end of 2.0 years you will have $ 12,477.23 with interest earned $477.23 Enter the starting principal, 0 to quit: 3000 Enter the annual interest rate : 1.89 How many times per year is the interest compounded? 1 For how many years will the account earn interest? 1 At the end of 1.0 years you will have $ 3,056.70 with interest earned $ 56.70 Enter the starting principal, 0 to quit: 0 Program existing
//loop
For this lab, write a python program so it will continuously be asking user for inputs to calculate the interest earned until the user enters number 0 (zero) in principle. Once the user enters any number less or equal to 0 in principle, the program will exist. Submit your python program and screenshot of your program output. HINT: Use while loop to ask user for inputs. Assuming the following variables: ● p holds the initial principle balance r holds the annual interest rate ● n holds how many times the interest compound in a year • t holds how many years will the acco earn interest To calculate ending total balance: ** • total = p*(1 + float( r / 100) / n) (n* t) interest total - p
Enter the starting principal, 0 to quit: 12000 Enter the annual interest rate : 1.95 How many times per year is the interest compounded? 365 For how many years will the account earn interest? 2 At the end of 2.0 years you will have $ 12,477.23 with interest earned $477.23 Enter the starting principal, 0 to quit: 3000 Enter the annual interest rate : 1.89 How many times per year is the interest compounded? 1 For how many years will the account earn interest? 1 At the end of 1.0 years you will have $ 3,056.70 with interest earned $ 56.70 Enter the starting principal, 0 to quit: 0 Program existing