selecting numbers from a list in python

list, python, random

Solution

Take a look at the `random` module.

>>> import random
>>> teams = ['One team', 'Another team', 'A third team']
>>> team1, team2 = random.sample(teams, 2)
>>> print team1
'Another team'
>>> print team2
'One team'

Problem

I am working on a program that generates a single elimination tournament. so far my code looks like this ( i have just started) ``` amount = int(raw_input("How many teams are playing in this tournament? ")) teams = [] i = 0 while i<amount: teams.append(raw_input("please enter team name: ")) i= i+1 ``` now i am stuck. I want to randomly pick 2 numbers that will select the teams facing eachother. the numbers cannot repeat at all, and have to range from 1 to "amount". What is the most efficient way to do this?

Original source