Can someone help me with my program keeping a counter in python -


i need program generate 100 numbers , count how many evens odds there is. having trouble counting part reason.

import random  def main():     x in range(101):         number = random.randint(1, 100)         print(number)         evennum = even(number)       print("total amount of numbers: ", evennum)     print("total amount of odd numbers: ", 100 - evennum)   def even(number):     count = 0     if (number % 2) == 0:         status = true     else:         status = false      if status == true:         count = count + 1     return count   main() 

i can program tell me if last number or odd cant keep running count on random numbers.

use counter class:

import collections import random  cnt = collections.counter() in range(101):   number = random.randint(1, 100)   if number % 2 == 0:     cnt['even'] += 1   else:     cnt['odd'] += 1 print(cnt)