Last answered:

08 Sept 2023

Posted on:

07 Sept 2023

0

Task 1. Import counters, part II

Why do you put UK and US in different variants of exceptions, not together?

Also, in the "while" part, when you ask for the recurring user input, there should be another user.input = user.input.lower() or more mistakes will be introduced 

4 answers ( 0 marked as helpful)
Posted on:

07 Sept 2023

0

In the Task 3 here, why do you use the range of the length of the key_names?

Were're lucky in this example that there are 4 key names and 4 companies. But if there were more, companies, we would receive the dictionary for only first 4 of them. It should rather be:

for i in range(len(companies)):

shouldn't it?

Instructor
Posted on:

08 Sept 2023

0

Hey Tetiana,


Thanks for reaching out.


Let me answer your questions one at a time.


1. Why do you put UK and US in different variants of exceptions, not together?

Please, refer to the following thread where I've suggested an alternative way to construct the while-loop:

https://365datascience.com/q/959a6578b7

2. In the "while" part, when you ask for the recurring user input, there should be another user.input = user.input.lower() or more mistakes will be introduced.

You can certainly include that in your code to make it less error-prone.


3. Why do you use the range of the length of the key_names?

I agree, if you instead use

for i in range(len(companies))

you won't get an error if the number of companies and key names mismatches.


You are always welcome to introduce changes in the code to improve it. The solutions presented in the lectures are exemplary and are only one of many ways to solve a problem.


Hope this helps!


Kind regards,

365 Hristina

Posted on:

08 Sept 2023

0

Hi, Hristina!

Thank you for the detailed answer! Will read the thread.

From the answer, am I right to conclude that there's no need to report found (suspected) mismatches and typos and only ask if there's smth not clear?

Instructor
Posted on:

08 Sept 2023

1

Hi Tetiana, 

let me chime in real quick - your feedback is very much appreciated and we'd love to hear more from you if you have different ideas and approaches towards the python code or other tasks. We've recently added a social feature to the platform, where students can share thoughts and questions about different topics, so I'd suggest you post anything that is not a question or a problem you're facing there. The Q&A hub is generally a place where students who've hit a wall during their studies or in their code can reach us, or if they have questions on the theory. I feel that the channels might be more appropriate and will be seen by more students, who'll benefit from your ideas. And it might generate some interesting discussions, which we like to encourage. In any case, we love hearing from our students, and would love it if you continue to share your thoughts and questions during the process. 


Best, 

365 Eli

Submit an answer