Wednesday, June 20, 2007

Python Programming Homework 1

อาจารย์ให้เมื่อวันที่ 19/6/50

even.py

# even.py
#
# A function that used to test if a number is even or not
#
# Written by Prem Sichanugrist (48050892)
#

def even(number) :
return (number % 2 == 0)



hypotenuse.py
# hypotenuse.py
#
# A function that will calculate a length of hypotenuse
# side of a right triangle given both other sides.
#
# Written by Prem Sichanugrist (48050892)
#

import math

def hypotenuse(side1, side2) :
return math.sqrt(float(side1) ** 2 + float(side2) ** 2)



การบ้านเสดแล้ว เย้!

No comments: