Ministério da Educação
Brasil um país de todos
Personal tools
Navigation
Log in


Forgot your password?
 
Document Actions

lista5-ex3.py

by Cicero Garrozi last modified 2015-09-25 05:49

Click here to get the file

Size 1 kB - File type text/python-source

File contents

from random import shuffle, randint

l = []
for i in range(10):
    l.append(input("Digite o nome da %da pessoa: "%(i+1)))

#embaralhando a lista:
shuffle(l)
#sorteando a 1a pessoa:
posicao = randint(0, len(l)-1)
print("Primeira pessoa sorteada: ", l.pop(posicao))
#sorteando a 2a pessoa:
shuffle(l)
posicao = randint(0, len(l)-1)
print("Segunda pessoa sorteada: ", l.pop(posicao))





Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: