Skip to content

Instantly share code, notes, and snippets.

@pedrolopesme
Created February 10, 2012 14:42
Show Gist options
  • Save pedrolopesme/1789961 to your computer and use it in GitHub Desktop.
Save pedrolopesme/1789961 to your computer and use it in GitHub Desktop.
# Vc monta assim
dict_medias = {}
for pergunta in perguntas:
# Atualiza media
if pergunta.id in dict_medias:
dict_medias[pergunta.id]['media'] = dict_medias[pergunta.id]['media'] + 3
# Cria pergunta
else:
dict_medias = { pergunta.id : { 'media' : pergunta.media, 'resposta' : pergunta.resposta} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment