0

I'm currently learning programming in Python. My goal with this module is to enter some data in a file and I want the user to be able to do it multiple times. However, my while loop will execute only once, even if I press "1" at the end, it won't execute again.

ctl = 1
while ctl == 1:

    print("\n")


    titre = input("Nom du film : ")
    année = input("Année : ")
    catégorie = input("Catégorie : ")


    fichier = open("Data_Film","a",encoding = "UTF-8")
    fichier.write(titre + ";" + année + ";" + catégorie + "\n")
    fichier.close()

    print("\n")
    print("1 - Ajouter un autre film")
    print("2 - Menu principal")


    ctl = input("Que vouez vous faire?")
TigerhawkT3
  • 48,464
  • 6
  • 60
  • 97
Gaboik
  • 75
  • 8

1 Answers1

1

You are comparing a string to an integer, and that will always be false.

You need to do:

ctl = int(input("Que vouez vous faire?"))
William
  • 2,695
  • 1
  • 21
  • 33