mardi 2 octobre 2018

Conditional checks being skipped after 2nd iteration

Python beginner here, would like to understand what is happening to my code snippet below? i am suppose to be reading from a CSV file and check the user's Input against the file. If user's input of Student ID exists within the CSV, the program will begin to print all existing information belonging to the Student ID.

The Contents of the CSV file are as follows

first_name,last_name,student_id,Math,Science,English,Art 
Peter,Tan,S1012342D,89,67,54,78
John,Lim,S1014322H,87,78,86,67
Ada,Ang,S1023456I,54,78,65,54

currently if i enter the correct ID on my first launch of the program, everything works correctly so far, all the outputs are coming out. But when i purposely enter a wrong input & enter the correct input afterwards, it fails to read the correct input and my output of contents is not appearing.

Code I am working on is as follows enter image description here Would hope someone can point out what i am doing wrong or misunderstanding.

Aucun commentaire:

Enregistrer un commentaire