Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. ''' Define your function here '''
  2. def GetUserValues():
  3.     user_int = int(input())
  4.     lst = []
  5.     for i in range(user_int):
  6.         lst.append(int(input()))
  7.     if IsListEven(lst):
  8.         print('all even')
  9.     elif(IsListOdd(lst)):
  10.         print('all odd')
  11.     else:
  12.         print('not even or odd')
  13. def IsListEven(lst2):
  14.     count = 0
  15.     for i in range(len(lst2)):
  16.         if lst2[i] %2 == 0:
  17.             count += 1
  18.     if count == len(lst2):
  19.         return True
  20.     else:
  21.         return False
  22. def IsListOdd(lst2):
  23.     count = 0
  24.     for i in range(len(lst2)):
  25.         if lst2[i] %2 != 0:
  26.             count += 1
  27.     if count == len(lst2):
  28.         return True
  29.     else:
  30.         return False
  31.  
  32. # The statement below replaces def main():  Do not elminate it.  Write your main program after this statement.
  33. if __name__ == '__main__':
  34.    ''' Type your code here. '''
  35.    GetUserValues()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement