Programming Fundamentals
This is my block and it's all about the code
วันอังคารที่ 22 กันยายน พ.ศ. 2558
Lab5-- Find average of values in array
def findAverage():
ListNum=[1,2,3,4,5,6,7,8]
i=0
sum=0
while(i<len(ListNum)):
sum=sum+ListNum[i]
i=i+1
average=sum/len(ListNum)
print("Average of Array =",average)
findAverage()
Result
Average of Array = 4.5
ไม่มีความคิดเห็น:
แสดงความคิดเห็น
บทความใหม่กว่า
บทความที่เก่ากว่า
หน้าแรก
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น