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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:54:10+00:00 2026-05-28T03:54:10+00:00

I just finished my homework writer program and now I have a really annoying

  • 0

I just finished my homework writer program and now I have a really annoying problem

I made it so when a function finishes it asks if it wants to rerun the main function, when i do that then run a different function (sorry if i suck at wording things) the function does nothing at all. Is there anything i can do?

Here is my code

agenda=open("agenda.txt","a") #open the notepad file
def choice(): #pick the period
    choice=input("type write, read, or clear\n")

    if choice=="read":
        read()
    elif choice=="write":
        write()
    elif choice=="clear":
        clear()
    else:
        print("Invalid Choice")


def write(): #write the homework
    per=input("What period is it")
    hw=input("What is the homework")
    if per=="1":
        agenda.write("Period 1:")
        agenda.write(hw)
        agenda.write("\n")
    elif per=="2":
        agenda.write("Period 2:")
        agenda.write(hw)
        agenda.write("\n")
    elif per=="3":
        agenda.write("Period 3:")
        agenda.write(hw)
        agenda.write("\n")
    elif per=="4":
        agenda.write("Period 4:")
        agenda.write(hw)
        agenda.write("\n")
    elif per=="5":
        agenda.write("Period 5:")
        agenda.write(hw)
        agenda.write("\n")
    elif per=="6":
        agenda.write("Period 6:")
        agenda.write(hw)
        agenda.write("\n")
    elif per=="7":
        agenda.write("Period 7:")
        agenda.write(hw)
        agenda.write("\n")
    elif per=="8":
        agenda.write("Period 8:")
        agenda.write(hw)
        agenda.write("\n")
    else:
        print("Non existant period")
    again=input("Would you like to read the homework, clear, or read again? (yes or no)")
    if again=="yes":
        choice()
    elif again=="no":
        print("\n")



def clear():#clear the whole thing
   ajenda = open('agenda.txt', 'r+')
   ajenda.truncate()
   again=input("Would you like to read the homework, clear, or read again? (yes or no)")
   if again=="yes":
       choice()
   elif again=="no":
       print("\n")

def read():#read the homework
    read=open("agenda.txt","r")
    readf=read.read()
    print(readf)
    read.close
    again=input("Would you like to read the homework, clear, or read again? (yes or no)")
    if again=="yes":
        choice()
    elif again=="no":
        print("\n")

choice()
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-28T03:54:11+00:00Added an answer on May 28, 2026 at 3:54 am

    I ran your code in python2.7 because I don’t have python3 right now.

    My guess is you ran your code, written some homework and then you asked to read it and nothing show up. When you write to a file, for performance reason, the buffer does not get into the file until a certain amount of data has been provided or until you close the file.

    If you test your code and then exit the program, you will find your data in the file. You may consider adding a flush() call in the write method.

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

Sidebar

Related Questions

I just finished a homework problem for Computer Science 1 (yes, it's homework, but
I just finished working out a memory allocation problem with the current program I'm
Just finished reading Crockford's JavaScript: The Good Parts and I have a question concerning
I just finished reading this post: https://developer.yahoo.com/performance/rules.html#flush and have already implemented a flush after
I just finished expanding my Palindrome Tester, made in C#. To allow for phrases
I just finished an issue in my homework, the purpose of this is to
just finished writing a five card poker hand evaluator in C++. now im looking
I just finished and turned in a homework assignment where the goal was to
I just finished a Java application to link to Sicstus prolog. Now I need
I just finished porting an application from Windows into Linux. I have to create

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.