Advertisement
Guest User

Untitled

a guest
May 4th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. # Initialize the number
  2. num_init = 34789593458634198
  3.  
  4. # Convert the number to a string
  5. number = str(num_init)
  6.  
  7. # Initialize the dictionary we are going to store the count(s) in
  8. numbers = {}
  9.  
  10. #Initialize the count to zero
  11. count = 0
  12.  
  13. # We are going to create a for loop in order to iterate through all the values in the string.
  14. for substring in number:
  15. #Determine if the number already exists in the dict.
  16. if substring not in numbers:
  17. # If the number does not already exists in the array, initialize it to zero
  18. numbers[substring] = 0
  19. # Increment the value of the Number(s) count
  20. numbers[substring] += 1
  21.  
  22. # Print the entire dictionary so we can see the counts.
  23. print numbers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement