Question | Answer |
---|---|
Name(First+Last) | Advay Shindikar |
1 | NA |
2 | NA |
3 | C- To make the simulation more accurate! |
4 | C- Imperfections on aircraft. |
5 | C Situation considered. |
6 | A- simulation, because it's too dangerous to have this be an experiment! |
7 | A- Simulation, heavy damage to the enviornment. |
8 | NA |
9 | B- Experiment/Calculation. No need to simulate anything, this will only be a simple calculation of the average. |
import random
p1dice1 = random.randrange(1,6)
p1dice2 = random.randrange(1,6)
print("Player 1 rolled a", p1dice1, "and", p1dice2, "for a sum of:", p1dice1+p1dice2)
p2dice1 = random.randrange(1,6)
p2dice2 = random.randrange(1,6)
print("Player 2 rolled a", p2dice1, "and", p2dice2, "for a sum of:", p2dice1+p2dice2)
p1sum = p1dice1 + p1dice2
p2sum = p2dice1 + p2dice2
if p1sum > p2sum:
print("Player 1 wins!")
elif p1sum == p2sum:
print("Roll again! You both rolled the same sum.")
else:
print("Yay! Player 2 wins!")
Here is a simulation of a dice role. There are two players and each of them roll a dice. In this simulation we create an artificial environment in which we can compare a dice roll between two individuals.