Hello. I have a couple of issues with the part II exam for data science foundations. The exam is composed of 6 questions. 3 of which are SQL, and the other 3 are python. The SQL questions are fine but there seems to be a bug with the Python questions. The first question is a loop. The question has a dictionary with items and their prices, and it wants me to create an empty list, then a loop which adds any odd prices to that empty list. So far so good. But then, whenever I try my code, it says I didn’t iterate over everything. I try again. I make another code. I have ChatGPT generate something, with all the same output. I managed to get the code from someone on this forum, and I will include it here if anyone needs it:
for i in range(len(all_items)):
if i % 2 == 0:
discounted_items.append(all_items[i])
print(discounted_items)
This is completely ridiculous. My code was with the exact same output as this and I don’t get the question correct. I guess it needs me to use range? It wasn’t mentioned to use range in the question though. They just wanted a loop. Moving on to the next question. The question has variable which are starting_money, num_of_items (or something like that), and then item_price. It asks me to make a function which iterates over the money, checks the item price, and deducts it from my money. Basically to check how many items I can buy with the money I have. So far so good. I write the function. It’s wrong. It says: “Something seems wrong. Check if the testing code at the bottom is still there. If it is, then check your math.” The code literally outputs everything correctly. I tried doing it differently, making ChatGPT do it, but nothing.
Then the third question, which asks me to do this:
The following dictionary contains the test scores of students in three different components of an exam:
test_scores = {“Gina”:[80, 72, 90], “Javed”:[88, 68, 81], “Siobhan”:[80, 82, 84], “Pedro”:[98, 96, 95], “Marcel”:[78, 80, 78], “Dilip”:[64, 60, 75]}
However, the teacher realizes that there was an error in one of the questions in the first component of the exam.
Modify test_scores to reflect this change by adding 1 point to the first component of each student’s exam. (Hint: use a for loop!)
Write it into a text file, modified_scores.txt.
I then do as asked, here is my code:
test_scores = {“Gina”:[80, 72, 90], “Javed”:[88, 68, 81], “Siobhan”:[80, 82, 84], “Pedro”:[98, 96, 95], “Marcel”:[78, 80, 78], “Dilip”:[64, 60, 75]}
print(test_scores)
Modify dictionary
for student, scores in test_scores.items():
scores[0] += 1
print(test_scores)
Write to a text file
with open(“modified_scores.txt”, “w”) as f:
for student, scores in test_scores.items():
f.write(f"{student}: {scores}\n")
Then it displays:
{“passed”:false, “errorMessage”: “Did you write the modified scores to the modified_scores.txt ?”} {“passed”: false, “errorMessage”: “Expected new file modified_scores.txt to be created.”}
I tried two other codes. I tried ChatGPT, and I even tried codes off this forum, to no avail. I can’t pass my exam, which means I can’t get my certificate. It’s really important I get the certificate, since it would help me a lot considering I’m in high school, and completing a Data analyst: Machine learning specialist career path and getting a certificate is important to me. And if it weren’t my certificate that’s important, I could never rest knowing I failed an exam. So if anyone has a solution to this or if codecademy could fix this, I’d appreciate that. Thank you.