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.
51 lines
4.2 KiB
51 lines
4.2 KiB
import random
|
|
|
|
# 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 = "Nom" + str(i)
|
|
prenom = "Prenom" + str(i)
|
|
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))
|
|
ville1 = "Ville" + str(random.randint(1, 60))
|
|
ville2 = "Ville" + str(random.randint(1, 60))
|
|
ville3 = "Ville" + str(random.randint(1, 60))
|
|
ville4 = "Ville" + str(random.randint(1, 60))
|
|
ville5 = "Ville" + str(random.randint(1, 60))
|
|
ville1 != ville2 != ville3 != ville4 != ville5
|
|
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))
|
|
decision1 = str(random.randint(-1, 1))
|
|
decision2 = str(random.randint(-1, 1))
|
|
decision3 = str(random.randint(-1, 1))
|
|
decision4 = str(random.randint(-1, 1))
|
|
decision5 = str(random.randint(-1, 1))
|
|
validation1 = str(random.randint(0, 1))
|
|
validation2 = str(random.randint(0, 1))
|
|
validation3 = str(random.randint(0, 1))
|
|
validation4 = str(random.randint(0, 1))
|
|
validation5 = str(random.randint(0, 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" + 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" + ville1 + "\t" + departement1 + "\t" + decision1 + "\t" + validation1 + "\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" + ville1 + "\t" + departement1 + "\t" + decision1 + "\t" + validation1 + "\t" + ville2 + "\t" + departement2 + "\t" + decision2 + "\t" + validation2 + "\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" + ville1 + "\t" + departement1 + "\t" + decision1 + "\t" + validation1 + "\t" + ville2 + "\t" + departement2 + "\t" + decision2 + "\t" + validation2 + "\t" + ville3 + "\t" + departement3 + "\t" + decision3 + "\t" + validation3 + "\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" + ville1 + "\t" + departement1 + "\t" + decision1 + "\t" + validation1 + "\t" + ville2 + "\t" + departement2 + "\t" + decision2 + "\t" + validation2 + "\t" + ville3 + "\t" + departement3 + "\t" + decision3 + "\t" + validation3 + "\t" + ville4 + "\t" + departement4 + "\t" + decision4 + "\t" + validation4 + "\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" + ville1 + "\t" + departement1 + "\t" + decision1 + "\t" + validation1 + "\t" + ville2 + "\t" + departement2 + "\t" + decision2 + "\t" + validation2 + "\t" + ville3 + "\t" + departement3 + "\t" + decision3 + "\t" + validation3 + "\t" + ville4 + "\t" + departement4 + "\t" + decision4 + "\t" + validation4 + "\t" + ville5 + "\t" + departement5 + "\t" + decision5 + "\t" + validation5 + "\n")
|