Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
10327 views
ubuntu2004
Kernel: R (system-wide)

Python Quizzes scratch Notebook

Use this Notebook to test your answers to the Python quizzies' questions before coping and pasting into a quiz.

number_of_flies = 4040 message("number of flies = ",number_of_flies) red<- rbinom(1, number_of_flies, 0.5) white<- number_of_flies - red message("number of red = ",red) message("number of White = ", white) expected = number_of_flies/2 D = 2*(abs(red-expected)) message("D = ", D)
number of flies = 4040 number of red = 2031 number of White = 2009 D = 22
V <- rbinom(10000000,number_of_flies,0.5) Dlist <- 2*abs(V-expected) barplot(table(Dlist), xlab = "difference score", ylab = "frequency")
Image in a Jupyter notebook