Betty's Bakery cookies eggs...?

Hello everyone!

Module: INTRODUCTION TO STATISTICS WITH NUMPY
Project: Betty’s Bakery

I am working on this project, even when the result is the same there is a small difference between the expert video approach and mine. The print is the same for both. Could anyone tell me the difference? is there any trouble with my approach?

Here my code:

cookies = recipes[2]
print(cookies)

>[ 2.75  1.5   1.    0.    1.  ]

Here the expert approach:

cookies_expert = recipes [2, :]
print(cookies_expert)
>[ 2.75  1.5   1.    0.    1.  ]

Thank you! and Take care. :slight_smile:

1 Like

In this instance, no, it’s the same slice of the array. The given apporach is perhaps a little more explicit. For arrays with more than 2 dimensions it may be better to start using more explicit methods so as to ensure it’s as easy to read as possible but generally just choose whichever way is clearest or consistent with any other code in the same project. Whatever makes it easier for anyone else looking through your code.

1 Like