I am trying to get this program to open the file and print a list of whether its a CD or a DVD and the amount they owe and the customers name, but I get a syntax error with printing the customers name
this is the syntax error I'm getting -
invalid syntax: BWHW7.pyw, line 25, pos 37 in file c:\Users\Benjaguin\Desktop\python\BWHW7.pyw, line 25 print(customer_name, end='\t')
This is code i used..
CD_SPINDLE = 16.50
DVD_SPINDLE = 21.75
def main():
cd_spindle_counter = 0
dvd_spindle_counter = 0
print("Guest Name \tSpindle Code\tAmount of Spindles\tAmount Due")
print()
try:
infile = open('spindles.txt', 'r')
customer_name = infile.readline()
while customer_name != '':
customer_name = customer_name.rstrip('\n')
print(customer_name, end='\t')
spindle_code = infile.readline()
spindle_code = room_type.rstrip('\n')
print(spindle_code, end='\t')
spindle_amount = infile.readline()
spindle_amount = int(spindle_amount)
print(spindle_amount, end='\t')
if spindle_code == "c" or spindle_Code == "C":
payment_due = spindle_amount * CD_SPINDLE
cd_spindle_counter += 1
elif spindle_code == "d" or spinlde_code == "D":
payment_due = spindle_amount * DVD_SPINDLE
dvd_spindle_counter += 1
else:
payment_due = 0
total_spindle_payment += payment_due
if payment_due ==0:
print('invalid code')
else:
print('$', format(payment_due, '8,.2f'))
guest_name = infile.readline()
infile.close()
print()
print('total number of CD spindles sold: ', cd_spindle_counter)
print('total number of DVD spindles sold: ',dvd_spindle_counter)
print()
print('total CD/DVD purchases: ', end='')
print('$', format(total_spindle_payment, ',.2f'), sep='')
except IOError:
print('an error occured trying to open or read spindle.txt')
main()