Incorrect Quiz Question

Course Name: Python for Trading: Basic, Section No: 9, Unit No: 3, Unit type: Quiz

Section 9, Unit 3: One of the questions asks how many times a statement will be printed after a print statement within an if statement within a for loop runs. It is fairly obvious that you are looking for the answer "three" (or "Thrice"), since it is simple to see the list at the top of the code has the number 2 three different times, and the print statement will be run once for each appearance of the number 2.  However, the last choice is "Wrong syntax", and is actually the correct answer, although the program will tell the user that this choice is incorrect. The question starts with the statement "Consider the following code:" followed by a more than obvious syntax issue that is surely just a typo. Nevertheless, the first line of code 'my_list[2,3,4,2,2]' does not result in the list assignment to the 'my_list' variable as it seems was intended. Had the '=' been in between the variable and the actual list, then the correct choice would be the one that is written into the course software. However, without the assignment operator '=' in that first line, the for loop, nor the if statement, nor the print statement, would ever even have the chance to "compile". Just wanted to make you aware. Thank you for all the material. I have been enjoying the course so far.

Hi William,

Thank you for pointing out the error! You are absolutely correct in the explaination.

We have corrected the same.



Regards.