แสดงบทความที่มีป้ายกำกับ Lab 4x แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ Lab 4x แสดงบทความทั้งหมด
วันอาทิตย์ที่ 20 กันยายน พ.ศ. 2558
Lab4x_Multiple_table
def setup():
n=int(input())
cal_result(n)
def cal_result(n):
count=12
mN=1
print("Multiple Table")
while (mN<=count):
ans=n*mN
print(n," x ",mN," = ",ans)
mN=mN+1
setup()
Lab4x_Plus_Number
def setup():
n = int(input())
calculate(n)
def calculate(n):
i=1
sums=0
while(i<=n):
print("i = ",i)
sums=sums+i
i=i+1
print("1+2+...+N,N = ",n)
print("The result is = ",sums)
setup()
Lab4x_Power_of_ten
def setup() :
power_number=int(input())
calculate(power_number)
def calculate(power_number) :
print("Value : 10 ^",power_number )
if (power_number==6) :
print("Million")
elif (power_number==9) :
print("Billion")
elif (power_number==12) :
print("Trillion")
elif (power_number==15) :
print("Quadrillion")
elif (power_number==18) :
print("Quintillion")
elif (power_number==21) :
print("Sextillion")
elif (power_number==30) :
print("Nonillion")
elif (power_number==100):
print("Googol")
else:
print("The value input doesn't have the word")
setup()
power_number=int(input())
calculate(power_number)
def calculate(power_number) :
print("Value : 10 ^",power_number )
if (power_number==6) :
print("Million")
elif (power_number==9) :
print("Billion")
elif (power_number==12) :
print("Trillion")
elif (power_number==15) :
print("Quadrillion")
elif (power_number==18) :
print("Quintillion")
elif (power_number==21) :
print("Sextillion")
elif (power_number==30) :
print("Nonillion")
elif (power_number==100):
print("Googol")
else:
print("The value input doesn't have the word")
setup()
Lab4x_Grade
def setup() :
score=int(input())
calculating(score)
showscore(score)
def calculating(score) :
if (score>=80) :
print("Your grade is A ." )
elif (score>=75) :
print("Your grade is B+ ." )
elif (score>=70) :
print("Your grade is B ." )
elif (score>=65) :
print("Your grade is C+ ." )
elif (score>=60) :
print("Your grade is C ." )
elif (score>=55) :
print("Your grade is D+ ." )
elif (score>=50) :
print("Your grade is D ." )
else :
print("Your grade is F ." )
def showscore(score):
print("Your score is ",score,".")
setup()
Lab4x_Leap_Year
def setup():
year_input=int(input())
calculate(year_input) #calculate the date
def calculate(year_input) :
if (year_input%4!=0):
print(year_input," isn't the Leap Year")
elif (year_input%100!=0):
print(year_input," is the Leap Year")
elif (year_input%400==0):
print(year_input," is the Leap Year")
else:
print(year_input," isn't the Leap Year")
setup()
year_input=int(input())
calculate(year_input) #calculate the date
def calculate(year_input) :
if (year_input%4!=0):
print(year_input," isn't the Leap Year")
elif (year_input%100!=0):
print(year_input," is the Leap Year")
elif (year_input%400==0):
print(year_input," is the Leap Year")
else:
print(year_input," isn't the Leap Year")
setup()
Lab4x_BMI
def setup():
w = int(input ())
h = int(input ())
calcu_bmi(w,h)
def calcu_bmi(w,h):
h2 = (h/100)**2
BMI = w/h2
print("Weight = ",w," Kg.")
print("Height = ",h," cm.")
print("Value Of BMI =%.2f"%BMI)
setup()
w = int(input ())
h = int(input ())
calcu_bmi(w,h)
def calcu_bmi(w,h):
h2 = (h/100)**2
BMI = w/h2
print("Weight = ",w," Kg.")
print("Height = ",h," cm.")
print("Value Of BMI =%.2f"%BMI)
setup()
Lab4x_Circle_Calculation
def setup() :
dm = int(input())
cal_circle(dm)
def cal_circle(dm):
r=dm/2
r_2=r*r
A=3.14*r_2
Cf=2*(3.14)*r
print("Value of circle's area = %.2f"%A,"m^2.")
print("Value of circumference's circle = %.2f"%Cf)
print("Diameter's circle = ",dm," m.")
print("Radius's circle = ",r," m.")
setup()
สมัครสมาชิก:
บทความ (Atom)