You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've completed the mad_libs function in Lesson 9 and when compared with the correct answer (mad_libs-correct.R) it is identical. However, when you run it, it says it is correct but it doesn't actually display the provided arguments within the printed text. See below:
Since it says this is correct, I'm not stuck or anything, but I am intrigued as to WHY it isn't actually displaying the text. With only a few lessons under my belt, I don't understand R well enough to know why this is happening or how to fix it, or similar issues I may come across, in the future. I'd appreciate any responses if someone has an answer, and it would be nice if the lesson were fixed to ensure no one else encounters this issue in the future.
The text was updated successfully, but these errors were encountered:
Your code does match the answer given and that is why you are getting the correct response. The key difference here is that you are passing in each argument as unnamed.
The solution is based around the idea that we can index certain values by name (get the value of "place" by using args[["place"]]). However, this relies on the argument submitted to be assigned that name.
You could see this by adding print(place) to the end of your function. If you do this, you will see a null value printed if your arguments are left unnamed. The function is working as it should because it returns nothing into the final pasted sentence.
If you adjust your code to the following, you should see the expected printed result: mad_libs(place = "Rockport", adjective = "many", noun = "fish")
I've completed the mad_libs function in Lesson 9 and when compared with the correct answer (mad_libs-correct.R) it is identical. However, when you run it, it says it is correct but it doesn't actually display the provided arguments within the printed text. See below:
![Screenshot 2024-10-24 094433](https://private-user-images.githubusercontent.com/19494945/379821106-1a8a4148-aad9-4ab0-8c7f-f278727523ca.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMjA0MzUsIm5iZiI6MTczOTAyMDEzNSwicGF0aCI6Ii8xOTQ5NDk0NS8zNzk4MjExMDYtMWE4YTQxNDgtYWFkOS00YWIwLThjN2YtZjI3ODcyNzUyM2NhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDEzMDg1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBiY2ZlOGJkMTk2MjJhYzkzMTZlYzc1NjE5YWY2MTJmNzU0MTZmMDhjM2VhNzk1NDFjM2Y5ODAzMDgzNTc0MzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.z-HwRzRAgBclhYk3jFaDUFEApI_oG07jbhkd3ALFt54)
Since it says this is correct, I'm not stuck or anything, but I am intrigued as to WHY it isn't actually displaying the text. With only a few lessons under my belt, I don't understand R well enough to know why this is happening or how to fix it, or similar issues I may come across, in the future. I'd appreciate any responses if someone has an answer, and it would be nice if the lesson were fixed to ensure no one else encounters this issue in the future.
The text was updated successfully, but these errors were encountered: