Computer Fundamental
วันพฤหัสบดีที่ 24 กันยายน พ.ศ. 2558
Lab 5 : Find/count number of positive values in array
def setup():
n=[2,5,-9,4,-6,8,7,-10,-1,-1,9,1]
print("number of positive = ",findPos(n))
def findPos(n):
i=0
countpos=0
while(i<len(n)):
if(n[i]>0):
countpos=countpos+1
i=i+1
return countpos
setup()
ไม่มีความคิดเห็น:
แสดงความคิดเห็น
บทความใหม่กว่า
บทความที่เก่ากว่า
หน้าแรก
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น