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