Advertisement
Redxone

[Python] Maps played reader

Dec 29th, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. index =  0
  2. words = ""
  3. realmaps = []
  4. final = 0
  5.  
  6. def isNum(s):
  7.     try:
  8.         int(s)
  9.         return True
  10.     except ValueError:
  11.         return False
  12.  
  13. for line in open("bzfile.txt"):
  14.     words += line
  15.  
  16.  
  17. for word in words.split():
  18.     if(word == 'Maps'):
  19.         realmaps.append(prevword)
  20.     prevword = word
  21.        
  22. for num in realmaps:
  23.     print(num)
  24.     if(isNum(num)):
  25.         final += int(num)
  26.  
  27.  
  28. print("Maps played: " + str(final))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement