3.16 Hacks
simulations, experiments
- Hack #1
- What makes it a simulation?
- What are it’s advantages and disadvantages?
- In your opinion, would an experiment be better in this situation?
- Hack #2
- Hack #3
- Hack #4
- Extra Credit
A simulation that allows people to try on clothes based on their clothing size and body measurements virtually when online shopping
What makes it a simulation?
- people don't have to go through the pain of going in stores and trying on clothes to see if it fits them, instead, they can just go online, put in their measurements and the simulation will tell you if you will fit the piece of clothing
What are it’s advantages and disadvantages?
- you don't have to leave your house to by clothes that fit!
In your opinion, would an experiment be better in this situation?
- It honestly depends on the person, but for me personally, I would prefer a simulation because shopping and trying on clothes in store stresses and grosses me out so for people like me, a clothing try on simulation could be very helpful
Hack #3
- Describe the rolling dice simulation (answer guiding questions) how this simulation works is by asking for how many die you want to roll first and then giving you a random output from 1 through 6. The purpose of this game is to simulate rolling as many die as you want! I you wanted to roll 50 die, it might be a little hard to find that many die, so a simulation would be better
def parse_input(input_string):
if input_string.strip() in {"1", "2", "3","4", "5", "6", "7", "8", "9", "10"}:
return int(input_string)
else:
print("Please enter a number from 1 to 10.")
raise SystemExit(1)
import random
def roll_dice(num_dice):
roll_results = []
for _ in range(num_dice):
roll = random.randint(1, 10)
roll_results.append(roll)
return roll_results
num_dice_input = input("How many dice do you want to roll? [1-10] ")
num_dice = parse_input(num_dice_input)
roll_results = roll_dice(num_dice)
print("you rolled:", roll_results)
numPetals = int(input("number of petals"))
while (numPetals > 0):
numPetals -= 1
print(numPetals)
if numPetals == 0:
print("No More Petals")
# EXTRA BONUS
if numPetals % 2 == 0:
print("he loves me")
if numPetals % 2 == 1:
print("he loves me not")