Archive

Archive for November 14, 2021

Python Project: Properties Maintenance System P7

November 14, 2021 1 comment

Subject: Writing a Full Application for Properties Maintenance System [Property: Showing the Records in Main property Table]
Learning : Python, Math, SQL, Logeic

[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.]


After adding Records to the Main Property Table, we need to display the records on the screen. So now in this part (Part -7) we will write a function to display all the records. The Function name will be def show_property() the function is not taking any attribute and is Not returning any things. First we will print-out the Table-Header then we will run an [SQL: select * from table-name] command to fetch all the records, then will [for loop] and test-format to print all the records on the screen. Here is the Code ..

python project Properties Maintenance System code by ali radwani doha qatar

After i display the records, I notes that the Address-Column needs more than one row (in some cases), and it miss the line formating, so I wrote a function and call it def warp_text(tex,warp_on,nl_space) the function takes three arguments,
the test: it the text/string you want to print.
warp_on: is a number of character before the new-line.
nl_space: is the number of white-character in the new-line.
Here is the Code ..

 # Function to warp 

def warp_text(tex,worp_on,nl_space) :
    c = 0
    
    for t in range (len(tex)) :
        print(tex[t],end="")
        c += 1
        if c == worp_on :
            print('\n', ' '*nl_space, end="")
            c = 0 



Check all the codes in the Download Page..
End of Part 7

NOTE: If you Download this Part you MUST Run the Option 82 (82. Delete the Data-Base and Start Again.) from the Main Menu to do the following Updates:

  • Update the properties_t Table (Adding the number of BathRooms)
  • Update on create_tables Function.
  • Update on insert_zero_records Function.

If you did this in last part (6) then you don’t need to do it again


In Part-8 In the Next Part, after adding and showing the records we will write the Function to Delete a record from the Table.



:: PMS Parts ::

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



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

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



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

By: Ali Radwani