cool, I only understood a bit
My Computer Science Exam PreRelease (Off Topic)
if name == "-1": #stop names
loop = False
break
here either the break isn't needed or the loop - false isn't needed
if name == "-1": #stop names
loop = False
break
here either the break isn't needed or the loop - false isn't needed
Hey.
I Just wanted to share my Computer Science Exam PreRelease Task that I just finished. It is quite long and is about Sorting Money for a School Trip and I want to know what do you all think. Thanks for stopping by!
#constant values coachCost = 550 costOfTicket = 30 maxStudents = 45 minStudents = 1 isValid = False while isValid == False: estStudents = int(input("Please enter the number of students estimated to go:")) if estStudents < minStudents or estStudents > maxStudents: print("Error - student number invalid") else: isValid = True freeTickets = estStudents // 10 print("Free Tickets:", freeTickets) totalCostOfTickets = (estStudents-freeTickets) * costOfTicket totalCostTrip = totalCostOfTickets + coachCost costPerStudent = round(totalCostTrip/estStudents,2) print("Total cost of Tickets", totalCostOfTickets) print("Total cost of Trip", totalCostTrip) print("Total cost per student", costPerStudent) paidArray = [] notpaidArray = [] counter = 0 loop = True while counter < 45 or loop == True: name = input("Enter the name of the Student going: or -1 to quit") if name == "-1": #stop names loop = False break paid = input("Have they paid? Y or N") if paid == "Y": paidArray.append(name) else: notpaidArray.append(name) counter = counter + 1 print("Paid", paidArray) print("Not Paid", notpaidArray) totalReceived = len(paidArray) * costPerStudent print("Total Money received:", totalReceived) print("Total Cost of Trip", totalCostTrip) if totalReceived > totalCostTrip: print("Profit made", totalReceived-totalCostTrip) elif totalReceived < totalCostTrip: print("Loss Made", totalCostTrip-totalReceived) else: print("Break Even")