Home > Learning, Lesson, Problem, Projects/Experiments, Python > Python: Coffee Consumption P8

Python: Coffee Consumption P8

Learning : Python, SQlite3, Dataset, Pandas,
Subject: Create Coffee Consumption Application.

[NOTE: To keep the code as simple as we can, We WILL NOT ADD any user input Varevecations. Assuming that our user will Enter the right inputs.]


In this part (Part-8) of Coffee Consumption App, we will write a Function to Delete a Record from the Main Table of the Coffee Consumption System.

Deleting a record is an easy SQL command having the Table Name and the Record ID that we want to Delete. In our Function First we wil display all the Records on the screen and asking the user to Select the ID of the Record, then we will display that record (again) on the screen and ask to Confirm the action by Entering [Y].
If the user Enter [Y] the Record will be Deleted, any thing else it wil be as No and the user will returned to the Main-Menu.

Coding: We will start the Function by displaying the header, then we will call the Function that will display all the Records in the data-base.. Here is the code..
show_records(inside = ‘yes’)
and asking the user to Select the ID.
NEXT: We will check the Availability of the ID, so if the user Enter an ID that not in the Data-Base or Empty space or just press Enter we will ask to re-enter the ID again. … Here is the code ..
while True:

del_rec_id = input (‘\n\n Select the Record ID to be Deleted > ‘)

if del_rec_id in [‘e’,’E’]:

input(‘ You Select [E to Exit].. Press any Key. > ‘)


elif (del_rec_id ==” “) or (del_rec_id ==””) or (check_availabilty(‘coffee_con’,’c_id’, int(del_rec_id)) != None):


If the ID is available, then we will display the Record and will ask the user to Confirm the Delete Command. This is the code for all the Delete Function ..

What’s Coming: In Part-9 we will Writing the Function to Edit a Coffee Record.

..:: Have Fun with Coding ::.. 🙂

Part 1 Part 2 Part 3 Part 4 Part 5
Part 6 Part 7 Part 8 Part – Part –

To Download my Python code (.py) files Click-Here

ali radwani ahradwani.com python projects codeFollow me on Twitter..

By: Ali Radwani

  1. No comments yet.
  1. September 30, 2021 at 7:12 am
  2. October 11, 2021 at 7:11 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s