[ create a new paste ] login | about

Link: http://codepad.org/pKfT4Gdc    [ raw code | output | fork ]

Python, pasted on May 28:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def my_condition(v):
  return v % 2 == 0

def do_if_pass(l):
  list_okay = True
  for v in l:
    if not my_condition(v):
      list_okay = False

  if list_okay:
    print 'everything in list is okay, including',
    for v in l:
      print v,
    print
  else:
    print 'not okay'

do_if_pass([1,2,3])
do_if_pass([2,4,6])


Output:
1
2
not okay
everything in list is okay, including 2 4 6


Create a new paste based on this one


Comments: