Advertisement
Guest User

DecodeSerNo.py

a guest
Feb 8th, 2021
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. AtoZ = ["A", "B", "C", "D", "E", "F", "G", "H",
  4.         "I", "J", "K", "L", "M", "N", "O", "P",
  5.         "Q", "R", "S", "T", "U", "V", "W", "X",
  6.         "Y", "Z"]
  7.  
  8. MaxDictionary = {}
  9.  
  10. for i in AtoZ:
  11.     MaxDictionary[i] = 0
  12.  
  13. #for i in AtoZ:
  14. #    print (i, MaxDictionary[i])
  15. #
  16. #print ("---------")
  17.  
  18. SerialFile = open("SerNo.txt", "r")
  19. for ALine in SerialFile:
  20.     char = ALine[0]
  21.     NumAsString = ALine[1:]
  22.     NumAsInt = int(NumAsString)
  23.     #print( char, NumAsString, NumAsInt, ALine)
  24.    
  25.     CurrentMax = MaxDictionary[char]
  26.     if NumAsInt > CurrentMax:
  27.         MaxDictionary[char] = NumAsInt
  28.         #print ("Max for " + char + " now " + str(NumAsInt))
  29.        
  30. for i in AtoZ:
  31.     print (i, MaxDictionary[i])
  32.    
  33.    
  34.    
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement