Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8392245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:28:10+00:00 2026-06-09T19:28:10+00:00

So far I have this program doing what i want. However when running through

  • 0

So far I have this program doing what i want. However when running through it will overwrite the last employee record instead of just adding to the file. I’m new to prgramming and have been staring at this for hours and i can’t get it yet. Just need a little nudge in the right direction.

# Define Employee Class
# Common Base Class for all Employees
class EmployeeClass:
def Employee(fullName, age, salary):
    fullName = fullName
    age = age
    salary = salary
def displayEmployee():
    print("\n")
    print("Name: " + fullName)
    print("Age: " + age)
    print("Salary: " + salary)
    print("\n")

EmployeeArray = []

Continue = True
print ("Employee Information V2.0")

while Continue == True:
print ("Welcome to Employee Information")
print ("1: Add New Record")
print ("2: List Records")
print ("3: Quit")

choice = input("Pick an option: ")

if choice == "1":
    fullName = input ("Enter Full Name: ")
    if fullName == "":
        blankName = input ("Please enter a name or quit: ")
        if blankName == "quit":
            print ("Goodbye!")
            print ("Hope to see you again.")
            Continue = False
            break
    age = input ("Enter Age: ")
    salary = input ("Enter Salary: ")
    EmployeeRecords = open ('EmployeeRecords.txt' , 'w')
    EmployeeRecords.write("Full Name: " + fullName + '\n')
    EmployeeRecords.write("Age: " + age + '\n')
    EmployeeRecords.write("Salary: " + salary + '\n')
    EmployeeRecords.close()
elif choice == "2":
    EmployeeRecords = open ('EmployeeRecords.txt', 'r')
    data = EmployeeRecords.read()
    print ("\n")
    print (data)
    EmployeeRecords.close
elif choice == "3":
    answer = input ("Are you sure you want to quit? " "yes/no: ")
    if answer == "yes" or "y":
        print ("Bye!")
        Continue = False
    else:
        Continue
else:
    print ("Please choose a valid option")
    print ("\n")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:28:12+00:00Added an answer on June 9, 2026 at 7:28 pm

    You are opening the file to be rewritten each time, based on the control string passed to open. Change open ('EmployeeRecords.txt, 'w')to open ('EmployeeRecords.txt', 'a+'). and the records will be appended to the end of the file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this so far but the Column 'name' is ambiguous, so I want
I have this so far: http://jsfiddle.net/u5vhS/54/ . What I want to be able to
So far i have this: mov ah,02h mov cl,11001100001111011101000b ;6,692,584 in dec mov dl,0
Thanks to everyone out there helping newbies like me. So far I have this:
I have this so far but I don't know how to write over the
I have this code so far which perfectly but relies on there being a
I have this trigger which works functionally (as far as I can tell by
I'm using the javascript module pattern, and have this so far: var APP; if(APP
I have used this effect before, everything is in order (As far as I
I am pretty new to this iPhone dev thing but so far I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.