How to select a number without replacement in python
<p>So I'm trying to make a mix and match between numbers here is my code</p>

<pre><code>import random

P1 = float(input("Person's name?")) 
P2 = float(input("Person's name?")) 
P3 = float(input("Person's name?"))

A1 = float(input("Activity?")) 
A2 = float(input("Activity?")) 
A3 = float(input("Activity?")) 

s = (A1, A2, A3)

cool1 = random.sample([A1, A2, A3],1)
cool2 = random.sample([A1, A2, A3],1)
cool3 = random.sample([A1, A2, A3],1)


print ("%s job is %s." %(P1, cool1))

print ("%s job is %s." %(P2, cool2))

print ("%s job is %s." %(P3, cool3))
</code></pre>

<p>The problem is that it is randomizing but it keeps repeating numbers like here</p>

<p>**</p>

<blockquote>
  <p>1.0 job is [4.0].
  2.0 job is [5.0].
  3.0 job is [4.0].</p>
</blockquote>

<p>**</p>

<p>What can I do to make it not repeat.
I'm using python 2.7.12</p>

<p>Also how can I use alphanumerical instead of float only.</p>

<p>Best way to achieve this will be to use <a href="https://docs.python.org/3/library/random.html#random.shuffle" rel="nofollow"><code>random.shuffle</code></a> (if you want to randomize the original sample list) or <a href="https://docs.python.org/3/library/random.html#random.shuffle" rel="nofollow"><code>random.select</code></a> (if you want to keep the original sample copy):</p>

<p><em>Example with <code>random.shuffle</code>:</em></p>

<pre><code>&gt;&gt;&gt; import random
&gt;&gt;&gt; my_samples = ['A1', 'A2', 'A3']
&gt;&gt;&gt; shuffle(my_samples)
&gt;&gt;&gt; cool1, cool2, cool3 = my_samples
# Random Result: cool1 = 'A3', cool2='A1', cool3='A2'
</code></pre>

<p><em>Example with <code>random.select</code>:</em></p>

<pre><code>&gt;&gt;&gt; cool1, cool2, cool3 = random.sample(['A1', 'A2', 'A3'], 3)
</code></pre>

<hr>

<p>If you want minimal changes in your solution. You may remove an entry from your samples based on random selection and get next choice from remaining samples like:</p>

<pre><code>&gt;&gt;&gt; import random
&gt;&gt;&gt; cool1 = random.sample(my_samples,1)
&gt;&gt;&gt; my_samples.remove(*cool1)
&gt;&gt;&gt; my_samples
['A1', 'A3']
&gt;&gt;&gt; cool2 = random.sample(my_samples,1)
&gt;&gt;&gt; my_samples.remove(*cool2)
&gt;&gt;&gt; cool3 = random.sample(my_samples,1)
&gt;&gt;&gt; my_samples.remove(*cool3)
&gt;&gt;&gt; my_samples 
[]
&gt;&gt;&gt; cool1, cool2, cool3
(['A2'], ['A3'], ['A1'])
</code></pre>

python python-2.7