Skip to content

Instantly share code, notes, and snippets.

@atilacamurca
Created November 26, 2013 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atilacamurca/7662476 to your computer and use it in GitHub Desktop.
Save atilacamurca/7662476 to your computer and use it in GitHub Desktop.
algoritmo para escolha de 5 questões aleatórias
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
questoes_disponiveis = [1, 2, 3, 4, 5, 6, 7, 8, 9]
questoes_escolhidas = []
i = 0
while i < 5:
rand = random.randrange(len(questoes_disponiveis))
questoes_escolhidas.append(questoes_disponiveis.pop(rand))
i += 1
print "as questões são ", questoes_escolhidas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment