Pack Your Bag explainer


#69

Your first line: var myBackpack = 'x'; can be eliminated. This is because you’re immediately overwriting this in your second line, where you declare the myBackpack variable again and assign it an object.

The string 'x' stored in myBackpack is never used in your code.

–Frankie


#70

Thank you so much! I made it work!!!


#71

Stucked.
Error as.

"Your packed your beg.to double check you have got the right food,print out the food properties value, using print(myBackpack.food)

Screen shots can’t be uploaded.
Shows only link of screen shot.


#72

Perhaps you’re printing out a string that says, “myBackpack.food” instead of the food property of the myBackpack object?

There shouldn’t be quote marks around the thing inside your print(). You’ll want to use the print() button, then the myBackpack button, then the .food button.

–Frankie


#73

Hi Heather, could I please get your help? I am not sure if I am messing syntax or something else up


#74

Each of your arrays [] only contains 1 string. For example, the myBackpack.food array has 1 element: the string 'bananas,energy bar'. That is seen a a single item even though it contains a comma and space. Notice there is only one pair of quotes surrounding the string.

You can change that first string to 'bananas', and then on the blank below that add another string using the str key. That will add the orange quote marks so you can type in your second item in the array. You’ll have to do the same for your other 2 arrays as well.

If you need any more help with this puzzle, you can check out the explainer for Get More Supplies.

–Frankie


Get More Supplies explainer
Get More Supplies explainer
#75

Hello @Grasshopper_Frankie

I don’t know why it doesn’t work. Can you help?


#76

Hi,

The only difference in your code is that you have curly brackets around the entire thing. This doesn’t affect how it will run, but it does affect the way we’re checking your code. We generally do this kind of check to make sure the solution isn’t tucked inside of an if statement or a loop.

Unfortunately, you can’t delete the brackets without deleting everything inside too. I would suggest, copying your solution to a new line below the big code block {} and then deleting the whole code block.

–Frankie


#77


Don’t know what I’m doing wrong, I read all the answers


#78

Whats the issue here then.


#79

Similar to the post above, your print() statement is inside of an additional code block {}. If you delete that block and then re-add print(myBackpack.food); it should work.

–Frankie


#80

Your print statement is using the string 'myBackpack.food' instead of the food property of the myBackpack object. Notice how the string is orange and surrounded by quote marks.

If you tap on the string once and then tap the delete button (the back arrow with the X, right below the green play button in your picture), you can remove the string and then insert the myBackpack identifier, and then attach the .food member expression to it.

–Frankie


#81

There is an error in Grasshopper! Just erase all your code and re-enter corrected code and all will be well.


#82

Erase everything and re enter.


#83

Hey @Jackie_Dander,

Would love to know more about the error you’re experiencing? Is there extra code when you first enter Pack Your Bag?

H :slight_smile:


#84

Hi sorry to bother you but I’m having issues with the backpack stage it would be nice if you could help me please


#85

@Grasshopper_Heather I’m having issues with the back pack stage and it would be nice if you would help me


#86


I don’t know what is wrong or how to continue


#87

Hey @Brenden_Washington,

Not bothering me at all! Could you share a screenshot of your code— I’ll take and look, and then give you some pointers?

Thanks,
H :slight_smile:


#88

Hey @11122,

Looks like it’s just a small typo — you’re using closing rather than clothing; an easy mistake to make! Once you adjust that then add print(myBackpack.food) you should solve this puzzle.

H :slight_smile: