The code is about displaying membership information of all clients from database. I was just wondering what I could do to improve/change it.
def optionA():
global DoAnother
while DoAnother == True:
print("")
member = input("Please enter the member number: ")
if len(member) !=4:
print ("")
print("The member number is not valid")
DoAnother = True
else:
global memberfile
memberfile = open("members.txt","r+")
searchMem = True
for line in memberfile.readlines():
listed = line.split(",")
if member in listed:
print("")
print("Team Code: {0}".format(listed[0]))
print("Member number: {0}".format(listed[2]))
print("Date of joining: {0}".format(listed[1]))
print("Membership type: {0}".format(listed[3]))
print("Amount paid: {0}".format(listed[5]))
searchMem = False
nextchoice()
if searchMem == True:
optionA()
def optionB():
print("")
print("Team Code Member No Fee Amount Paid Amount Outstanding")
print("----------------------------------------------------------------------------------------")
global memberfile
memberfile=open("members.txt","r+")
amountOut = 0
for line in memberfile.readlines():
listed = line.split(",")
if listed[3] =="F" and listed[5].strip('\n')<listed[4]:
difference = (int(listed[4])-int(listed[5]))
amountOut = (amountOut + difference)
print("{0} {1} £{2} £{3} £{4}".format(listed[0], listed[2], listed[4], listed[5].strip('\n'), difference))
print("")
print(" Total Outstanding: £{0}".format(amountOut))
nextchoice()
next_choice()
do? How/where isDoAnother
initialized? Also what version of Python are you using? \$\endgroup\$