#

Hacks 1

One idea for a simulation is a flight simulator. It is better to code a flight simulator and test out planes in it than doing it in real life. IRL planes are very expensive compared to the endless simulations that can be run on a computer. A flight simulator is a simulation because it takes IRL factors (physics, engineering) and combines it into a computer program. A big disadvantage would be the fact that a simulation is not 100% accurate. I don't think an experiment would be better in this case. A real life experiment would cost too much money and time. The flight simulator would take in irl factors and combine it into a program. You can then input any situation and run it to get visual output.

Hacks 2

questions_number = 6
answers_correct = 0
questions = [
    "True or False: Simulations will always have the same result. \n A: True, \n B: False",
    "True or False: A simulation has results that are more accurate than an experiment \n A: True, \n B: False",
    "True or False: A simulation can model real world events that are not practical for experiments \n A: True, \n B: False",
    "Which one of these is FALSE regarding simulations \n A: Reduces Costs, \n B: Is safer than real life experiments, \n C: More Efficient, \n D: More accurate than real life experiments",
    "Which of the following scenarios would be the LEAST beneficial to have as a simulation \n A: A retail company wants to identify the item which sold the most on their website, \n B: A restaurant wants to determine if the use of robots will increase efficiency, \n C: An insurance company wants to study the impact of rain on car accidents, \n D: A sports car company wants to study design changes to their new bike design ",
    "Which of the following is better to do as a simulation than as a calculation \n A: Keeping score at a basketball game, \n B: Keeping track of how many games a person has won, \n C: Determining the average grade for a group of tests, \n D: Studying the impact of carbon emissions on the environment"
]
question_answers = [
    "B",
    "B",
    "A",
    "D",
    "A",
    "D"
]

print("Welcome to the Simulations Quiz!")

def ask_question (question, answer):
    print("\n", question)
    user_answer = input(question)
    print("You said: ", user_answer)

    if user_answer == answer:
        print("Correct!")
        global answers_correct
        answers_correct = answers_correct + 1
    else:
        print("You are incorrect")
    
for num in range(questions_number):
    ask_question(questions[num], question_answers[num])

print("You scored: ", answers_correct, "/6")
Welcome to the Simulations Quiz!

 True or False: Simulations will always have the same result. 
 A: True, 
 B: False
You said:  B
Correct!

 True or False: A simulation has results that are more accurate than an experiment 
 A: True, 
 B: False
You said:  B
Correct!

 True or False: A simulation can model real world events that are not practical for experiments 
 A: True, 
 B: False
You said:  A
Correct!

 Which one of these is FALSE regarding simulations 
 A: Reduces Costs, 
 B: Is safer than real life experiments, 
 C: More Efficient, 
 D: More accurate than real life experiments
You said:  D
Correct!

 Which of the following scenarios would be the LEAST beneficial to have as a simulation 
 A: A retail company wants to identify the item which sold the most on their website, 
 B: A restaurant wants to determine if the use of robots will increase efficiency, 
 C: An insurance company wants to study the impact of rain on car accidents, 
 D: A sports car company wants to study design changes to their new bike design 
You said:  A
Correct!

 Which of the following is better to do as a simulation than as a calculation 
 A: Keeping score at a basketball game, 
 B: Keeping track of how many games a person has won, 
 C: Determining the average grade for a group of tests, 
 D: Studying the impact of carbon emissions on the environment
You said:  D
Correct!
You scored:  6 /6

Hacks 3

Rolling dice simulation:

What makes it a simulation?
- It takes in the features of a die and represents those features in a code. You can then run the code and roll the die how many ever times you want(code: input the number of times you roll the die). You will then get to see the end result of your roll (code: returns the output). 

Disadvantages and advantages?
- One advantage of this simulation is that you dont need a physical die. You have a virtual die which doesn't take up any physical space compared to an actual die (okay fine, a real die takes up a negligible amount). One disadvantage is the physical interaction and excitement of rolling a die. Unless you code a 3d simulation of a die, then you won't get that experience. 

Would an experiment be better?
- Yes. For me, rolling a die in real life is a lot more suspenseful and satisfying than rolling it on a computer. 

Hacks 4

import random

/**
    * ! Changed number of sides on a die to 14 and max number of rolls to 14
    * @param args
    * @throws Exception
    */


def parse_input(input_string):
    if input_string.strip() in {"1","2","3","4","5","6","7","8","9","10","11","12","13","14"}:
        return int(input_string)
    else:
        print("Please enter a number from 1 to 14.")
        raise SystemExit(1)



def roll_dice(num_dice):
    roll_results = []
    for _ in range(num_dice):
        roll = random.randint(1, 14)
        roll_results.append(roll)
    return roll_results

num_dice_input = input("How many dice do you want to roll? [1-14] ")
num_dice = parse_input(num_dice_input)
roll_results = roll_dice(num_dice)

print("you rolled:", roll_results)

Bonus:

For the bonus, I made a population simulation. This is a very basic simulation that does not take in factors such as infant mortality rate, fertility, and food. The initial population is 75 and the rate of growth is 1.0008% (daily). We can find the daily growth by multiplying population*growthrate and then subtracting population. One advantage is that it can let you predict future populations, allowing you to prepare for what's coming. One disadvantage is the lack of reality. You can only add so many factors, but in the end, it will still be somewhat inaccurate. In this case, I would say that a simulation is better than an experiment. Well, an experiment would be somewhat unethical.

population = 75
growthrate = 1.0008
day = 0

while population <= 10000:
    population *= growthrate
    day += 1
    if day == 120:
        day = 0
        print(f"this month the total population is {population}")
this month the total population is 82.55376136399722
this month the total population is 90.86831353791744
this month the total population is 100.02028095144162
this month the total population is 110.09400540300364
this month the total population is 121.18232332861587
this month the total population is 133.38742135473754
this month the total population is 146.8217780197062
this month the total population is 161.60920034235468
this month the total population is 177.88596479052237
this month the total population is 195.80207316428277
this month the total population is 215.5226349677352
this month the total population is 237.2293890088841
this month the total population is 261.1223782502173
this month the total population is 287.421793344905
this month the total population is 316.37000184809915
this month the total population is 348.2337818039382
this month the total population is 383.30678029232814
this month the total population is 421.9122195927332
this month the total population is 464.4058759041721
this month the total population is 511.17935807241565
this month the total population is 562.6637165401538
this month the total population is 619.3334157791423
this month the total population is 681.7107068130758
this month the total population is 750.3704401270476
this month the total population is 825.9453633179457
this month the total population is 909.1319523073298
this month the total population is 1000.6968298555237
this month the total population is 1101.48383052802
this month the total population is 1212.4217772228226
this month the total population is 1334.5330409248838
this month the total population is 1468.9429625717664
this month the total population is 1616.8902238596363
this month the total population is 1779.7382625638475
this month the total population is 1958.9878375742796
this month the total population is 2156.2908594410665
this month the total population is 2373.4656138888845
this month the total population is 2612.5135185951476
this month the total population is 2875.6375676576076
this month the total population is 3165.262633730023
this month the total population is 3484.0578149243456
this month the total population is 3834.9610324217906
this month the total population is 4221.206105477029
this month the total population is 4646.352553330655
this month the total population is 5114.31839867544
this month the total population is 5629.416274983376
this month the total population is 6196.393170447736
this month the total population is 6820.474174808599
this month the total population is 7507.410632219408
this month the total population is 8263.533143917026
this month the total population is 9095.809909152116