im new ish to python and ive got this code and i want it to allow for the word "exit" to be entered at any time when inputting. And once that is done, it closes the script.
Any help would be really appreciated.
import sys
while True:
def inputs():
first=input("Enter your first name: ")
last=input("Enter your last name: ")
gender=input("Enter your gender: ")
form=input("Enter your form: ")
file = open("signup.txt", "a")
#Records the user's details in the file
file.write("\nFirst name: "+first+", Last name: "+last+", Gender: "+gender+", Form: "+form)
#Closes the file
file.close()
if input(inputs) == "exit":
sys.exit()
inputs()