import pickle def write_bin( ): bin_file = ______________ #Statement 1 while True: c_no = int(input(βenter customer numberβ)) c_name = input(βenter customer name β) qty = int(input(βenter priceβ)) price = int(input(βenter priceβ)) if ________________ #Statement 2 print(βQuantity less than 10β¦Cannot SAVEβ) else: amt = price * qty c_detail = [c_no, c_name, qty, price, amt] ______________ #Statement 3 ans = input(βDo you wish to enter more records y/nβ) if ans.lower( ) = = βnβ: ____________ #Statement 4 ________________________ #Statement 5 ______________________________ #Statement 6
a) Write the correct statement to open a file βCust_file.datβ for writing the data of the customer. [1] b) Which statement should Shreyas fill in Statement 2 to check whether quantity is less than 10. [1] c) Which statement should Shreyas fill in Statement 3 to write data to the binary file and in Statement 4 to stop further processing if the user does not wish to enter more records. [2] OR(Option for part (c) only) c) What should Shreyas fill in Statement 5 to close the binary file named Cust_file.dat and in Statement 6 to call a function to write data in a binary file? [2]
(i) Statement 1 : open("Cust_file.dat", "wb") (ii) Statement 2 : qty<10 (iii) Statement 3 : pickle.dump(c_detail, bin_file) Statement 4 : break or Statement 5 : bin_file.close() Statement 6 : write_bin()