# Deal probability

Page 1 of 1

## 3 Replies - 289 Views - Last Post: 01 October 2012 - 07:56 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=293884&amp;s=4e015d0facf98cd0994c61a7904539a0&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 q81101

Reputation: 0
• Posts: 28
• Joined: 28-September 12

# Deal probability

Posted 01 October 2012 - 03:05 PM

```def main():

import random
# Prompt the use to enter number of times
times = eval(input("Enter number of time you want to play: "))

print("Prize", "\tGuess", "\tView", "\tNewGuess")

# Table layout
for i in range(1, times +1):
print(" ", random.randint(1,3), end = '')
print("      ", random.randint(1,3))

main()
```

I want each column generate random number from 1 to 3. For "views" colummn, the random number can not be the Prize or guess.(ex when i have prize = 2, guess = 2, my view can only be 1 or 3.)

I realize I didn't assign the variable for random, but when I assign prize = random it give me the coulmn with all same number, what can I do to have different random number in each row.

```def main():

import random
# Prompt the use to enter number of times
times = eval(input("Enter number of time you want to play: "))

print("Prize", "\tGuess", "\tView", "\tNewGuess")

# variables
prize = random.randint(1,3)
guess = random.randint(1,3)

# Table layout
for i in range(1, times +1):
print(" ", prize, end = '')
print("      ", guess)

main()
```

Is This A Good Question/Topic? 0

## Replies To: Deal probability

### #2 q81101

Reputation: 0
• Posts: 28
• Joined: 28-September 12

## Re: Deal probability

Posted 01 October 2012 - 07:30 PM

Never mind I got this one

### #3 midknight51

Reputation: 20
• Posts: 47
• Joined: 25-September 12

## Re: Deal probability

Posted 01 October 2012 - 07:44 PM

Care to share how you solved it? I thought it had something to do with the seed but I could be wrong.

### #4 q81101

Reputation: 0
• Posts: 28
• Joined: 28-September 12

## Re: Deal probability

Posted 01 October 2012 - 07:56 PM

midknight51, on 01 October 2012 - 07:44 PM, said:

Care to share how you solved it? I thought it had something to do with the seed but I could be wrong.

```def main():

import random
# Prompt the use to enter number of times
times = eval(input("Enter number of time you want to play: "))

print("Prize", "\tGuess", "\tView", "\tNew Guess")

# Table layout
for i in range(1, times +1):
prize = random.randint(1,3)
guess = random.randint(1,3)

print("", prize, end = '')
print("      ", guess, end = '')
```

it seem like the random has to be in inner loop