Advertisement
hackloper775

mayor elemdiccpy

Jun 23rd, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. Dic = {
  4.         "Clave" : "Valor",
  5.         "ClaveNumero2" : "Valor_numero2"
  6. }
  7.  
  8. def espacios(valor,val=False):
  9.         strvalor,strclave = [],[]
  10.         for clave in valor:
  11.                 strvalor.append(len(valor[clave]))
  12.                 strclave.append(len(clave))
  13.         if val:
  14.                 strvalor.sort()
  15.                 return (strvalor[len(strvalor)-1])
  16.         else:
  17.                 strclave.sort()
  18.                 return (strclave[len(strclave)-1])
  19.  
  20. print ("La string mayor de clave es : %d") %(espacios(Dic,False))
  21. print ("La string mayor de valor es : %d") %(espacios(Dic,True))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement