Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python project help
#2
Well, that was a bit of a mess  Shocked , lets see if we can partially fix it a bit.

# School Register
import time

# Python loves lower case function names


def create():
   # Using this method, Python will close the file automatically
   with open("SchoolRegister.txt", "w") as file:
       reg_create = input("Please enter the people present\n")
       file.write(reg_create)


def access():
   # Using this method, YOU must close the file
   file = open("SchoolRegister.txt", "r")
   print(file.read())
   file.close()


def leave():
   print("Thank you for using SchoolReg, goodbye!")
   time.sleep(3)
   quit()


def menu():
   print("""   Welcome to SchoolReg

               1.Create Register
               2.Access Register
               Press 'Q' to quit""")
   opt = input("              Please select an option: ")
   if opt == '1':
       create()
   elif opt == '2':
       access()
   elif opt == 'Q':    # Python does NOT love using it's keywords, such as 'quit'
       leave()

   return


menu()
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Messages In This Thread
Python project help - by gullidog - Jul-20-2017, 02:57 PM
RE: Python project help - by sparkz_alot - Jul-20-2017, 03:37 PM
RE: Python project help - by gullidog - Jul-20-2017, 03:46 PM
RE: Python project help - by sparkz_alot - Jul-20-2017, 04:53 PM
RE: Python project help - by gullidog - Jul-20-2017, 06:11 PM
RE: Python project help - by Larz60+ - Jul-20-2017, 06:24 PM
RE: Python project help - by gullidog - Jul-20-2017, 06:29 PM
RE: Python project help - by Larz60+ - Jul-20-2017, 06:50 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020