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 7062901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:38:59+00:00 2026-05-28T04:38:59+00:00

I have a great idea for a homework note pad and I wrote the

  • 0

I have a great idea for a homework note pad and I wrote the basics of the program. The problem is that when I add more (I rerun the program) all the contents get wiped out and replaced with the new homework assignment. Is there any way I can fix this?

def query_period(agenda_file):
    per = input("What period is it?")

    if per in ["1", "2", "3", "4", "5", "6", "7", "8"]:
        input_and_write_homework(agenda_file)
    else:
        print("Invalid choice")

def input_and_write_homework(file):
    hw = raw_input("What is the homework?")
    file.write(hw)

if __name__ == "__main__":
    agenda = open("agenda.txt", "w+")
    query_period(agenda)
    agenda.close()
  • 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-05-28T04:39:00+00:00Added an answer on May 28, 2026 at 4:39 am

    To append to a file in python use the ‘a’ attribute, so change:

    agenda=open("agenda.txt","w+")
    

    to:

    agenda=open("agenda.txt","a")
    

    You should probably be using raw_input() and type cast to a string, instead of input().

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

Sidebar

Related Questions

I have a great idea for a 3D network game, and I've concluded that
I used to have a great Firefox add-on for this and I can't remember
I have an otherwise working iPhone program. A recent change means that it generates
Question If you have what you think is a great idea, how do you
I have a great idea about cheating on exams. My school uses very old
I think I have a great idea for an iOS development tool, but I
I have a great idea for a biometric security app and some secure transactions,
Hypothetical question (at the moment!) Suppose I have a great idea for an application.
1st post on stackoverflow, hope to have great feedback :) I'm currently trying to
I have a great deal of data to keep synchronized over 4 or 5

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.