AP4B week 3 Assignment - Comments and suggestions

Hello,

I just finished the programming assignment of week 3 and I really enjoyed it (@Mubsi)

Nevertheless I would like to make 2 suggestions for improvement:

  1. In exercise 3 we are asked to fill the list of dictionaries topics_to_use.

The key for the topic is set as “Topic 1”, “Topic 2” and “Topic 3” for the 3 dictionaries.

But wouldn´t it make more sense to have a common key “Topic” for all of them (as you have with “to_use”)?
In my opinion this would make more sense when you want to process this list (as we did with the restaurants list of dictionaries in the course).
It would be difficult to iterate over topics_to_use and have something like

for topic in topics_to_use:
if topic[“to_use”] == True:
print topic[“topic”]

(sorry for the missing indention, I do not know how to do that here)

  1. This brings me to my second point. The boolean values of “to_use” are not used in excercise 4 at all.

To be more consistent with was has been written in exercise 3 the task in exercise 4 could be to include the topics_to_use list but instruct the llm to only take those topics where the value of “to_use” is True.

For example:

“Using only the topics from the list <topics_to_use> where the value of “to_use” is True, write a 4-line poem.”

Was that not the intention?

I hope that makes sense

With best regards
Jochen

hi again @Jochen_Keilitz

you can surely use the iteration method, but make sure don’t name the dictionary as well as list items with same name. This can sometimes cause conflict where you want to use dictionary and sometimes you want to use specific list item. That’s when usually programmer encounter attribute error like you are using a global variable instead of a local variable or vice-versa.

You also need to understand there will be always different ways to recall a variable or dictionary or key() or list, an item.

The task here in question is more behind understanding this is a beginner course and not all can get the iteration python steps.

So the approach is from simpler to tricky eventually, when a programmer get used to common way of using functions, variables and keys.

Regards
DP

1 Like

can I know what was the exercise 4? you did mention what it could be but haven’t mentioned what it is mentioned.

Hi @Jochen_Keilitz,

@Deepti_Prasad beat me to it! I was going to say exactly the same!

The assignment is designed and targeted towards people who are new to these concepts, and the idea is to take them step by step, even if it involves not using more practical ways of programming.

For the ease of learners, topics have been numbered so that it serves as a reminder of having three unquie topics

Actually, the LLM is smart enough to figure this out when you pass the entire dictionary to it, even if you don’t explicitly mention “to_use” in the prompt. I encourage you to try a prompt, for example the suggested prompt:
"Using only the topics from the list <topics_to_use>, write a 4-line poem."

and try different combinations of true and false on the topics. You shall notice the impact.

Best,
Mubsi

2 Likes

Hi @Mubsi and @Deepti_Prasad,

thank you very much for your response.

  • I understand what you mean with the topic key. I mentioned it because we worked in the course with the restaurant table which similarily translates into a list of dictionaries [{“Restaurant”: “…”, “Best dish”: “…”},{“Restaurant”: “…”, “Best dish”: “…”}, …]. But I understand what you say and I am aware that the task was meant to fill in the different topics and not to forget the commas. I also understand the naming advice.

  • Wow. I would not have thought that the llm is smart enough to figure out the intention of the “to_use” values. That`s very impressive. Of course then you do not need an extra instruction.

Thank you for pointing it out.

Jochen

1 Like

i saw your response to his other query that you were busy, so responded to this query. @Mubsi