It's not working properly [Solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

It's not working properly [Solved]

Check out my below code. And help me why does it give some correct answer as wrong even if I give proper input and there is some problem related to scores. Please check out the error and help me to solve this issue. Thanks in advance https://code.sololearn.com/c1n5IEmUfnpz/?ref=app

15th Feb 2021, 4:31 PM
Aysha
Aysha - avatar
4 Answers
+ 1
questions = {q1:"a",q2:"c",q3:"b",q4:"a",q5:"d",q6:"d",q7:"a",q8:"a"} answers=ans.split(",") index=0 points=0 for i in questions: print(answers[index]) if answers[index]==questions [i]: print("Congrats!! Your answer is Correct\n") points = points + 1 print ("***************************************\n") else: print("Sorry!! Your answer is Wrong\nThe Correct answer is " + questions[i] + "\n") points = points - 1 print ("***************************************\n") index+=1 print ("Congrats!! " + name + " you have completed the quiz\n") The above code is considering answer as "a,c, b,d, a, ..... " And if user enters all 8 answers.
15th Feb 2021, 4:54 PM
Abhay
Abhay - avatar
+ 8
Abhay it's working little bit proper now but still if the inputs are given correct it's saying wrong answer. What to do now please help me and thank you
16th Feb 2021, 2:37 AM
Aysha
Aysha - avatar
+ 8
Abhay it's working fine. the problem is that we should not give any spaces Ex a,b,c,d It's working fine now. Once again thank you so much
16th Feb 2021, 9:58 AM
Aysha
Aysha - avatar
0
Aysha what inputs are giving you wrong answer?
16th Feb 2021, 7:43 AM
Abhay
Abhay - avatar