run this: wget https://raw.githubusercontent.com/shruthim0/datapirates/master/_notebooks/2022-12-12-hw.ipynb
Binary Hack EXPLANATION
Using Binary for Simulations
Now you will combine everything we have talked about so far, plus binary. Imagine that there is a zombie apocalypse. A household with 8 survivors is observed. Let's create a simulation where we see how many of the people have been transformed into zombies. This will involve three functions.
- FIrst, a function for randomizing decimal number 0-255
- Next, a function for converting this to a 8-bit binary number (one bit per person)
- Lastly, a function to read the binary bits, and assign each person a label (zombie or naw) based on the position of 0s and 1s
THe amount of people who are zombies is randomly determined. Based on the placement of the 1s and 0s in the 8 bit number, each person is assigned as being a zombie or not
Binary Hack ANSWER
run this: wget https://raw.githubusercontent.com/shruthim0/datapirates/master/_notebooks/2022-12-12-hw.ipynb
Binary Hack EXPLANATION
Using Binary for Simulations
Now you will combine everything we have talked about so far, plus binary. Imagine that there is a zombie apocalypse. A household with 8 survivors is observed. Let's create a simulation where we see how many of the people have been transformed into zombies. This will involve three functions.
THe amount of people who are zombies is randomly determined. Based on the placement of the 1s and 0s in the 8 bit number, each person is assigned as being a zombie or not
Binary Hack ANSWER