0

Please help me to debug my program.

Usser input : (any integer ) - # it represents the how many no are there to check. The according to this input, let say user input : 3 Then we will enter three no. And program should check weather it it prime no or not.. For example. - Program runs - it will ask for input Kindly look into problem.. I am not able to expain here.. https://code.sololearn.com/cRD8uWH1qFU2/?ref=app

29th Apr 2021, 4:30 PM
Ashutosh R. Yadav
Ashutosh R. Yadav - avatar
3 Réponses
+ 1
there is a few errors in your code, one of them causing the index out of range is because of how you access your variable from the for loop: for i in numberList: in a for loop, the "i" represent the number itself and not the index of this number. also when you have nested loops, avoid using the same variable for the second one: for i in range(4): for j in range(8): print(i + j) I don't think these are the only problems but I hope it will help you to troubleshoot your code have fun coding!
29th Apr 2021, 4:44 PM
Apollo-Roboto
Apollo-Roboto - avatar
0
How can I take the index of list in line 8
29th Apr 2021, 4:50 PM
Ashutosh R. Yadav
Ashutosh R. Yadav - avatar
0
Apollo-Roboto kindly check it now.
29th Apr 2021, 5:01 PM
Ashutosh R. Yadav
Ashutosh R. Yadav - avatar