You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
3.7 KiB

import random
import string
# Ouverture du fichier en mode écriture
with open("resultats.txt", "w") as f:
# Écriture des en-têtes de colonnes
f.write("Numero de candidat\tNom\tPrenom\tNote de maths\tNote de francais\tNote d'anglais\tNote de specialite\tNombre de choix de candidatures\tVille choisie de la premiere candidature\tDepartement\tDecision du departement\tValidation\n")
# Génération de données aléatoires pour chaque candidat
for i in range(1, 100):
nom = ''.join(random.choices(string.ascii_lowercase, k=20))
nom = nom.capitalize()
prenom = ''.join(random.choices(string.ascii_lowercase, k=20))
note_maths = str(random.randint(0, 20))
note_francais = str(random.randint(0, 20))
note_anglais = str(random.randint(0, 20))
note_specialite = str(random.randint(0, 20))
nb_choix = str(random.randint(1, 5))
ville = "Clermont-Ferrand"
departement1 = "Departement" + str(random.randint(1, 20))
departement2 = "Departement" + str(random.randint(1, 20))
departement3 = "Departement" + str(random.randint(1, 20))
departement4 = "Departement" + str(random.randint(1, 20))
departement5 = "Departement" + str(random.randint(1, 20))
departement1 != departement2 != departement3 != departement4 != departement5
decision = "0"
validation = "0"
#f.write(str(i) + "\t" + nom + "\t" + prenom + "\t" + note_maths + "\t" + note_francais + "\t" + note_anglais + "\t" + note_specialite + "\t" + nb_choix + "\t" + ville + "\t" + departement + "\t" + decision + "\t" + validation + "\n" )
# Écriture des données dans le fichier, séparées par des points-virgules
if nb_choix == "1":
f.write(str(i) + "\t" + nom + "\t" + prenom + "\t" + note_maths + "\t" + note_francais + "\t" + note_anglais + "\t" + note_specialite + "\t" + nb_choix + "\t" + ville + "\t" + departement1 + "\t" + decision + "\t" + validation + "\n")
elif nb_choix == "2":
f.write(str(i) + "\t" + nom + "\t" + prenom + "\t" + note_maths + "\t" + note_francais + "\t" + note_anglais + "\t" + note_specialite + "\t" + nb_choix + "\t" + ville + "\t" + departement1 + "\t" + decision + "\t" + validation + "\t" + ville + "\t" + departement2 + "\t" + decision + "\t" + validation + "\n")
elif nb_choix == "3":
f.write(str(i) + "\t" + nom + "\t" + prenom + "\t" + note_maths + "\t" + note_francais + "\t" + note_anglais + "\t" + note_specialite + "\t" + nb_choix + "\t" + ville + "\t" + departement1 + "\t" + decision + "\t" + validation + "\t" + ville + "\t" + departement2 + "\t" + decision + "\t" + validation + "\t" + ville + "\t" + departement3 + "\t" + decision + "\t" + validation + "\n")
elif nb_choix == "4":
f.write(str(i) + "\t" + nom + "\t" + prenom + "\t" + note_maths + "\t" + note_francais + "\t" + note_anglais + "\t" + note_specialite + "\t" + nb_choix + "\t" + ville + "\t" + departement1 + "\t" + decision + "\t" + validation + "\t" + ville + "\t" + departement2 + "\t" + decision + "\t" + validation + "\t" + ville + "\t" + departement3 + "\t" + decision + "\t" + validation + "\t" + ville + "\t" + departement4 + "\t" + decision + "\t" + validation + "\n")
elif nb_choix == "5":
f.write(str(i) + "\t" + nom + "\t" + prenom + "\t" + note_maths + "\t" + note_francais + "\t" + note_anglais + "\t" + note_specialite + "\t" + nb_choix + "\t" + ville + "\t" + departement1 + "\t" + decision + "\t" + validation + "\t" + ville + "\t" + departement2 + "\t" + decision + "\t" + validation + "\t" + ville + "\t" + departement3 + "\t" + decision + "\t" + validation + "\t" + ville + "\t" + departement4 + "\t" + decision + "\t" + validation + "\t" + ville + "\t" + departement5 + "\t" + decision + "\t" + validation + "\n")