Advertisement
PiggiesGoSqueal

Untitled

Feb 15th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. """
  2. 190
  3. hashing1
  4. Name
  5. """
  6.  
  7. hashList = []
  8.  
  9. Hash = 0
  10. x = input("Please input a string: ")
  11. m = len(x)
  12.  
  13. for i in range(len(x)):
  14. hashList.append(x[i])
  15. newXOrds = ord(hashList[i])*m
  16. m -= 1
  17. Hash = Hash + newXOrds
  18. Hash %= 11
  19.  
  20. print("The string contains:", hashList)
  21. print("The Hash is:", Hash)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement