Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.74 KB | None | 0 0
  1. class Foto():
  2.     estratto = 0
  3.     def __init__(self, link):
  4.         self.link = link
  5.  
  6. def byEstratto_key(foto):
  7.     return foto.estratto
  8.  
  9. def randomPick(fotos = []):
  10.     if(len(fotos) > 1):
  11.         sorted(fotos, key = byEstratto_key)
  12.         fotos[0].estratto += 1
  13.     return fotos[0].link
  14.    
  15. #iti
  16. dodo = [Foto('https://scontent-mxp1-1.xx.fbcdn.net/hphotos-frc3/v/t1.0-9/1964944_10200264091081487_8289592002775596944_n.jpg?oh=91c0e1d41dcd1fb55a180f196a242dea&oe=56A2A50B'),
  17.         Foto('https://lh5.googleusercontent.com/-RtV6zxIMDO0/AAAAAAAAAAI/AAAAAAAAAGo/U7kHAP4NE-Y/photo.jpg')]
  18. ennio = [Foto('http://s12.postimg.org/z2qmz6li1/rsz_disperazione.jpg')]
  19. guru = [Foto('mantegazza')] #ADDA mantego nudo, ti mando la foto
  20.  
  21. #unitn
  22. rseba = [Foto('http://disi.unitn.it/~rseba/Photos/Personale/Io/Grecia1993.jpg')]
  23. anny = [Foto('http://latemar.science.unitn.it/segue_userFiles/defrance/tre.jpg')]
  24. aletoma = [Foto('http://disi.unitn.it/~tomasi/ale.jpg')]
  25. occhetta = [Foto('http://i.imgur.com/rMBBqMP.jpg')]
  26. nonMiPiace = [Foto('http://s24.postimg.org/8anhr1yfp/nonmipiace.jpg')]
  27.  
  28. #/b
  29. whoisthis = [Foto('https://upload.wikimedia.org/wikipedia/so/1/18/John-cena.jpeg')]
  30. landwhale = [Foto('https://pbs.twimg.com/media/CF6CWATUoAAa5jv.png')]
  31.  
  32. #personaggi mitologici
  33. guastella = [Foto('https://scontent-mxp1-1.xx.fbcdn.net/hphotos-xaf1/v/t1.0-9/10410768_836906726330201_523458070976718469_n.jpg?oh=d762b68d62b29ee9669c43a20ecfc515&oe=565E01D3')]
  34. collo = [Foto('http://i.imgur.com/px4ghZw.jpg'),
  35.          Foto('http://s28.postimg.org/5xfe32inh/index.jpg')]
  36.  
  37.  
  38. #ESEMPIO
  39. print randomPick(dodo)          #restiruisce il link della foto meno estratta
  40. print randomPick(whoisthis)     #restiruisce il link dell unica foto prensete nella lista
  41.  
  42. #tuo nudo TheG
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement