Friday, September 16, 2016

Lab 1 - 2.6

Lab One: Questions Two and Three

Question 2

PV = 60000 #You Borrow $60,000
r = 0.05 # Yearly Interest = 5%
n = 8 # 8 years
r = r/12 #Monthly Payment
n = n*12 #96 months
top = r* PV
bottom = 1-(1+r)**-n
fraction = top / bottom
P=fraction
print ("P = "+str(P))
print ("PV = "+str(PV))
print ("Monthly Interest = "+str(r))
print ("Number of Periods in Months = "+str(n))



Question 3

PV = 60000 #You Borrow $60,000
r = 0.05 # Yearly Interest = 5%
n = 48 
r = r/12 #Monthly Payment 
#96 months
P=759.59520072743
part1=PV*(1+r)**n
part2=P*((((1+r)**n)-1)/r)
FV=part1-part2
print(FV)

Lab 1.5 Questions 1-3

Question 1

import math
from builtins import printfrom builtins import strr = 0.06 #Annual Interest RateP = 1000 #Beginning Balance of a Savings Accountt = 2 #Number of Yearsn = 1v = (P)*((1)+(r/n))**(n*t)
va = (P)*((1)+(r/12))**(12*t)
vb = (P)*((1)+(r/365))**(365*t)
vc = (P)*((1)+(r/8760))**(8760*t)
print ("Compounded Yearly: Balance After Two Year(s)= " +str(v))
print ("Compounded Monthly: Balance After Two Year(s)= " +str(va))
print ("Compounded Daily: Balance After Two Year(s)= " +str(vb))
print ("Compounded Hourly: Balance After Two Year(s)= " +str(vc))
print ("Limit = $" +str(P*math.e**(r*t)))

Question 2

import math
from builtins import print

P = 100r = (0.06/12)
n = 2 * 12FV = (P)*((((1+r)**n)-1)/r)
print("FV = $"+str(FV))

Question 3


import math
from builtins import print
P = 100r = 0.06/12FV = 4000


a = (1 + ((FV * r)/P))
b = math.log(a)
c = 1+r
d = math.log(c)
print ("Number of Periods = "+ str(b/d))


Lab 2.6 and Lab 2

Lab 2.6
import datetime
def print_b_day_invitation(age,name,party_date,time,address,reply_date):
print ("\n")
print (datetime.date.today())
print ("\n")
print ("              "+str(age))
print ("        "+str(name)+"'s"+" "+"turning"+" "+str(age))
print ("Let's Celebrate with dinner and drinks")
print (str(party_date)+" | "+str(time)+" | "+str(address))
print ("     Kindly RSVP by "+str(reply_date))
print_b_day_invitation(26,"Emily","October 12","6pm","450 Williams Street","October 1")
print_b_day_invitation(80,"John","November 21","8pm","123 Oak Street","November 1")
print_b_day_invitation(51,"Mary","December 12","6:30pm","456 Maple Street","December 1")
Lab 2
Q1
import datetime
datetime.date.today()
print ( "Today's Date = "+str (datetime.date.today()))
def print_3rd_business_letter(your_name,your_address,recipient_name,title,company_address):
   print ("\n")
   print (your_name)
   print (your_address)
   print ("\n")
   print (datetime.date.today())
   print ("\n")
   print (recipient_name)
   print (title)
   print (company_address)
   print ("\n")
   print ("Dear "+ (recipient_name)+ ",")
   print ("")
   print ("This is the first paragraph. It is three sentences long. This is the last sentence.")
   print ("")
   print ("This is the second paragraph. It is three sentences long. This is the last sentence.")
   print ("")
   print ("Sincerely, ")
   print (your_name)
print_3rd_business_letter("Nicholas Benson","123 Fakestreet\nFakeville AL 35810","Clark Kent","Superman", "Fakestreet\nFakeville Al 35810")

Q2
#Day of the week for April 1, 1921#What Day of The Week Does 4 Mean?#Use a Date Object to Find A Function That Returns Today's Date#Find the Number of Days In Between Today And January 1, 1970import calendar
import datetime
import time
from datetime import date
def day_of_week(year, day_number, month):
   day_value = (calendar.weekday((year),(month),(day_number)))
   if day_value == 0:
      day="Monday"   if day_value == 1:
      day="Tuesday"   if day_value == 2:
      day="Wednesday"   if day_value == 3:
      day="Thursday"   if day_value == 4:
      day="Friday"   if day_value == 5:
      day="Saturday"   if day_value == 6:
      day="Sunday"   print (str(month)+"/ "+str(day_number)+"/ "+str(year) + " was on a "+(day))
   print ( "Today's Date = "+str (datetime.date.today()))
day_of_week((1921), (1), (4))
def day_difference():
   today = time.localtime()
   gmtimea = time.time()
   print ("The Difference of Days Between Today and January 1, 1970: ")
   print (int(gmtimea/86400))
day_difference()

No comments:

Post a Comment