Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. def main():
  2. pop_num = []
  3. inFile = open ("Census_2009a.txt", "r")
  4. count = 0
  5. for line in inFile:
  6. if (count == 0):
  7. count += 1
  8. continue
  9. else:
  10. count += 1
  11. line = line.strip()
  12. word_list = line.split()
  13. pop_num.append (word_list[-1])
  14. inFile.close()
  15. print (pop_num)
  16. print (count-1)
  17.  
  18. first_dig = []
  19. for i in range (count-1):
  20. first_dig.append(pop_num[i][:1])
  21. print(first_dig)
  22.  
  23. counter = 0
  24. for j in range (1, 10):
  25. for k in range (count - 1):
  26. #print(j, first_dig[k - 1])
  27. if (j == int(first_dig[k])):
  28. counter += 1
  29. print(j, counter, counter / (count - 1) * 100)
  30. counter = 0
  31.  
  32.  
  33. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement