Created
November 26, 2013 17:30
-
-
Save atilacamurca/7662476 to your computer and use it in GitHub Desktop.
algoritmo para escolha de 5 questões aleatórias
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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