The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Create a Python-based exit survey tool

Here is a simple Python-based Exit Survey Tool that runs in the terminal. It collects basic feedback from users when they leave an organization or event and stores the responses in a CSV file for further analysis.

python
import csv from datetime import datetime def display_intro(): print("nWelcome to the Exit Survey Tool") print("Please take a few moments to answer the following questions.") print("Your feedback is valuable and will help us improve.n") def get_response(prompt): response = input(f"{prompt}n> ") return response.strip() def collect_survey(): survey_data = { "Timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"), "Name": get_response("1. What is your full name?"), "Department": get_response("2. Which department were you part of?"), "Reason for Leaving": get_response("3. What is your primary reason for leaving?"), "Experience Rating": get_response("4. How would you rate your overall experience (1-5)?"), "Suggestions": get_response("5. Do you have any suggestions for improvement?"), "Would Recommend": get_response("6. Would you recommend this organization to others? (Yes/No)") } return survey_data def save_to_csv(data, filename='exit_survey_responses.csv'): fieldnames = data.keys() try: with open(filename, mode='a', newline='', encoding='utf-8') as file: writer = csv.DictWriter(file, fieldnames=fieldnames) if file.tell() == 0: writer.writeheader() writer.writerow(data) print("nThank you! Your feedback has been recorded.") except Exception as e: print(f"Error saving survey data: {e}") def run_survey(): display_intro() data = collect_survey() save_to_csv(data) if __name__ == "__main__": run_survey()

Features:

  • Runs in command-line or terminal.

  • Collects key feedback from users.

  • Stores responses in a CSV file with a timestamp.

  • Appends to the CSV if it already exists.

How to Use:

  1. Save the code in a file, e.g., exit_survey.py.

  2. Run it using Python: python exit_survey.py.

  3. It will prompt the user for input and store it in exit_survey_responses.csv.

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About