def setup():
a = [1,2,3,4,5,6,7,8,9,10,-11,-90]
print(sum_positive(a))
def check_positive(x):
positive=False
if x>=0:
positive=True
return positive
def sum_positive(a):
sum=0
i=0
while i<len(a):
if check_positive(a[i]):
sum+=a[i]
i+=1
print("Sum:",sum)
setup()
============================================================
def setup():
a = [1,2,3,4,5,6,7,8,9,10,-11,-90]
sum_positive(a)
def sum_positive(a):
sum=0
i=0
while i<len(a):
if a[i]>=0:
sum+=a[i]
i+=1
print("Sum:",sum)
setup()
========================= RETURN ============================
def setup():
a = [1,2,3,4,5,6,7,8,9,10,-11,-90]
print(sum_positive(a))
def sum_positive(a):
sum=0
i=0
while i<len(a):
if a[i]>=0:
sum+=a[i]
i+=1
return sum
setup()
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
commit เพิ่มเติม : เพื่ม userstory, bookmark
>> add userstory ทำการเพิ่ม userstory ใน functional tests >> add bookmark for user เพิ่มระบบ Bookmark โดยการสร้าง model ขึ...
-
1 2 3 4 5 6 7 8 9 def setup (): print (d2b( 8 )) def d2b (num): x = "" while num > 0 : x = str ( int (n...
-
1 2 3 4 5 6 7 8 9 10 11 12 13 def test_layout_and_styling ( self ): # Edith goes to the home page self . brow...
-
การใช้ template inheritence คือการสืบทอดเทมเพลต เพื่อให้ไม่ต้องเขียนโค้ดหน้าเว็บๆซ้ำๆ เราจะมีหน้าหลักอันเดียว (base.html or parent) ภายในนั...
ไม่มีความคิดเห็น:
แสดงความคิดเห็น