Skip to content
Extraits de code Groupes Projets
validity_check.py 926 o
import csv
import sys

if __name__ == "__main__":

    modified_lines = sys.argv[1]
    author = sys.argv[2]
    modifs = modified_lines.split('\n')

    if len(modifs) != 2:
        print("You modify wrong number of lines !")
        exit(1)

    if author not in modifs[0] and (author not in modifs[1]) :
        print("You modify the line of another student !\n")
        exit(1)

    curr_line = modifs[1].split(',')

    if len(curr_line) != 4:
        print('You broke file format by suppressing/adding "," !\n')
        exit(1)

    prev_line = modifs[1].split(',')
    modifs[0]= modifs[0][1:]
    modifs[1]=modifs[1][1:]
    
    for i in range(modifs[0]):
        if i<3 and prev_line[i] != curr_line[i] :
            print('You modify your data !\n')
            exit(1)
    if(curr_line[4]) !='VU' or (curr_line[4]) !=' VU' or (curr_line[4]) !='VU ':
        print('You have to write "VU" in the last column !\n')