def setup():
loan_money(5000,0.12,1)
def loan_money(amount,rate,year):
month = year*12
ratepermonth = rate/12
paypermonth = amount*(ratepermonth/(1-pow(1+ratepermonth,-month)))
principal = paypermonth
unpaid = amount
interest_total = 0
x = 1
print("Num. Interest Principal Unpaid Interest total")
while(x <= month):
print(max(x, 2))
print(" %.2f"%max(ratepermonth*unpaid, 2, 2), end = "")
interest_total+=ratepermonth*unpaid
principal=paypermonth-(ratepermonth*unpaid)
unpaid -= principal
if(unpaid < 0):
unpaid = 0
print(" %.2f"%max(principal, 3, 2), end = "")
print(" %.2f"%max(unpaid, 4, 2), end = "")
print(" %.2f "%max(interest_total, 3, 2), end = "")
print()
x += 1
setup()
แสดงบทความที่มีป้ายกำกับ Lab 4x แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ Lab 4x แสดงบทความทั้งหมด
วันจันทร์ที่ 14 กันยายน พ.ศ. 2558
Leap years Lab4x.
year = 2038
def setup():
if (year%4==0):
print(year," This year is leap year")
elif (year % 4 != 0):
print(year," This year isn't leap year")
elif (year % 4 == 0 and year % 100 != 0):
print(year," This year is leap year")
elif (year % 4 == 0 and year % 100 == 0 and year % 400 != 0):
print(year," This year isn't leap year")
elif (year % 4 == 0 and year % 100 == 0 and year % 400 == 0):
print(year," This year is leap year")
setup()
def setup():
if (year%4==0):
print(year," This year is leap year")
elif (year % 4 != 0):
print(year," This year isn't leap year")
elif (year % 4 == 0 and year % 100 != 0):
print(year," This year is leap year")
elif (year % 4 == 0 and year % 100 == 0 and year % 400 != 0):
print(year," This year isn't leap year")
elif (year % 4 == 0 and year % 100 == 0 and year % 400 == 0):
print(year," This year is leap year")
setup()
วันอาทิตย์ที่ 13 กันยายน พ.ศ. 2558
Prime number Lab4x.
def setup():
print(sum_prime(10))
def sum_prime(n):
x = 2
sum = 0
while (x <= n):
if (prime(x)):
sum += x
x += 1
return sum
def prime(p):
x = 2
if (p==1):
return False
while (x<p):
if (p%x == 0):
return False
x += 1
return True
setup()
print(sum_prime(10))
def sum_prime(n):
x = 2
sum = 0
while (x <= n):
if (prime(x)):
sum += x
x += 1
return sum
def prime(p):
x = 2
if (p==1):
return False
while (x<p):
if (p%x == 0):
return False
x += 1
return True
setup()
Number sum Lab4x.
def setup():
print(sum_number(10))
def sum_number(n):
x = 0
sum = 0
while (x <= n):
sum += x
x +=1
return sum
setup()
print(sum_number(10))
def sum_number(n):
x = 0
sum = 0
while (x <= n):
sum += x
x +=1
return sum
setup()
Multiplication table Lab 4x.
def setup():
N = 1
r = 13
x = 8
while(N<r):
p = x*N
print(x," x ",N," = ",p)
N += 1
setup()
N = 1
r = 13
x = 8
while(N<r):
p = x*N
print(x," x ",N," = ",p)
N += 1
setup()
Grade Lab 4x.
def setup():
score = 95;
if (score < 0):
print("Error")
print("Error")
elif (score < 50):
print("F")
print("-")
elif (score >= 50 and score < 55):
print("D")
print("1.00")
elif (score >= 55 and score < 60):
print("D+")
print("1.50")
elif (score >= 60 and score < 65):
print("C")
print("2.00")
elif (score >= 65 and score < 70):
print("C+")
print("2.50")
elif (score >= 70 and score < 75):
print("B")
print("3.00")
elif (score >= 75 and score < 80):
print("B+")
print("3.50")
elif (score >= 80 and score <= 100):
print("A")
print("4.00")
elif (score > 100):
print("Error")
print("Error")
print("Mr.Titi Rungruang (Cpr.E)")
print("Computer Programming Fundamental")
print("Your score = ",score)
print("You get")
print("GPAX")
setup()
score = 95;
if (score < 0):
print("Error")
print("Error")
elif (score < 50):
print("F")
print("-")
elif (score >= 50 and score < 55):
print("D")
print("1.00")
elif (score >= 55 and score < 60):
print("D+")
print("1.50")
elif (score >= 60 and score < 65):
print("C")
print("2.00")
elif (score >= 65 and score < 70):
print("C+")
print("2.50")
elif (score >= 70 and score < 75):
print("B")
print("3.00")
elif (score >= 75 and score < 80):
print("B+")
print("3.50")
elif (score >= 80 and score <= 100):
print("A")
print("4.00")
elif (score > 100):
print("Error")
print("Error")
print("Mr.Titi Rungruang (Cpr.E)")
print("Computer Programming Fundamental")
print("Your score = ",score)
print("You get")
print("GPAX")
setup()
Circle lab4x.
def setup():
r = 300
print("CircumferenceOfCircle = ",CircumferenceOfCircle(r))
print("areacircle = ",areacircle(r))
def CircumferenceOfCircle(r):
CircumferenceOfCircle = 2*(22/7)*r
return CircumferenceOfCircle
def areacircle(r):
areacircle = (22/7)*r*r
return areacircle
setup()
r = 300
print("CircumferenceOfCircle = ",CircumferenceOfCircle(r))
print("areacircle = ",areacircle(r))
def CircumferenceOfCircle(r):
CircumferenceOfCircle = 2*(22/7)*r
return CircumferenceOfCircle
def areacircle(r):
areacircle = (22/7)*r*r
return areacircle
setup()
BMI Lab 4x.
def setup():
heightbody=1.73
weightbody=58
print("Height = ",heightbody," m.")
print("Weight = ",weightbody," kg.")
print("BMI = ",cal(heightbody, weightbody))
def cal(heightbody,weightbody):
BMI=weightbody/(heightbody*heightbody)
return BMI
setup()
heightbody=1.73
weightbody=58
print("Height = ",heightbody," m.")
print("Weight = ",weightbody," kg.")
print("BMI = ",cal(heightbody, weightbody))
def cal(heightbody,weightbody):
BMI=weightbody/(heightbody*heightbody)
return BMI
setup()
สมัครสมาชิก:
บทความ (Atom)
Link Video Presentation Resort Managemant System Project.
Video Presentation Resort Managemant System Project. จัดทำโดย พากษ์เสียง: คุณาสิน ทองมณี 5801012620011 ลำดับภาพ: สุพิชชา ศรีศิริ...
-
- 1NF หรือ Fisrt Normal Form มีเงื่อนไขอยู่ว่า ต้องไม่มีคอลลัมน์ใดในตารางที่มีค่ามากกว่า 1 ค่า หรือที่เรียกว่า Atomic ซึ่งหมายถึง ข้อมูลที่...
-
เนื่องจากวันที่ 27 กุมภาพันธ์ ถึง 22 มีนาคม 2561 เป็นช่วงเวลาของการสอบกลางภาค ซึ่งทำให้ต้องแบ่งเวลาในการทำงานและอ่านหนังสือสอบอย่างหนัก จึง...