Q. Use RotateLeft and Count to find the number of planets detected by each method, presenting the result in a list of the form {{D, n1}, {R, n2}, {T, n3}}.
planets = {{Beta Pictoris B, D, {7, 1.6}}, {WASP52B,
T, {0.453, 1.270}}, {Kepler426b, T, {1.0, 1.090}}, {CoRoT6b,
T, {2.95, 1.166}}, {Kepler34b, R, {0.220, 0.784}}, {Kepler367b,
R, {0.0037, 0.116}}, {Kepler200c, R, {0.0119, 0.142}}};
I have got this far with it;
new = RotateLeft[planets, {1, 4}]
new2 = new[[All, 1]]
Count[new2, T]
But I'm not sure if this is the correct way. Bare in mind I need to use these two functions to answer, so although I'm sure there are other ways to solve this please use Count and RotateLeft.
Thank you!
RotateLeft
.Count
andMap
would make more sense, andTally
andRotateLeft
orPart
would make sense, butCount
andRotateLeft
is definitely an X-Y problem. While I can't speak for the graders, I would hope that any solution that returns the correct form would be considered correct. Also, if you're usingPart
(as[[]]
) then you can omit the rotate entirely:new2=planets[[All, 2]]
. $\endgroup$