Programming Fundamentals
This is my block and it's all about the code
วันอาทิตย์ที่ 4 ตุลาคม พ.ศ. 2558
Lab5-Sum of postive value
def sumOfPositve(array):
i = 0
sumPosi = 0
while(i<len(array)):
if(array[i]>0):
sumPosi+=array[i]
i+=1
return sumPosi
def setup():
A=[28,-32,-90,60,-100,12,-50,60]
print("Sum of positive value =",sumOfPositve(A))
setup()
Result
Sum of positive value = 160
ไม่มีความคิดเห็น:
แสดงความคิดเห็น
บทความใหม่กว่า
บทความที่เก่ากว่า
หน้าแรก
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น