A program that will ask the person’s name and it will allow the user to sort the person’s name using ascending and descending order using Python programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.
Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support.

Program Listing

import sys
data = []

class RecordKeepingApp:
    def __init__(self, choice):
        '''Takes 1 parameter. Returns an input asking to try again.'''
        self.choice = choice
        data.append(choice)
        cont = input("Try again? yes/no: ").lower()

        if (cont.lower() == "yes"):
            pass
        elif (cont.lower() == "no"):
            print()
            print("How do you want to display the list of names?")
            print("[A] - Ascending Order")
            print("[D] - Descending Order")
            display = input("Enter your choice: ").upper()

            if (display == "A"):
                data.sort()
            elif (display == "D"):
                data.sort(reverse=True)
            else:
                print("Your choice is not valid")

            print()
            print("*************************************")
            print("*           LIST OF NAMES           *")
            print("*************************************")
            for index, item in enumerate(data):
                print('{}: {}'.format(int(index)+1, item))

            print("Total number of names inputted is ", len(data))
            sys.exit("\n\n")
        else:
            print("Invalid response. Please try again.")

        print()

print("*************************************")
print("*   Welcome to Record Keeping App   *")
print("*************************************\n")

while True:
    selection = input('Enter a name: ')
    RecordKeepingApp(selection)

Leave a Reply

Your email address will not be published.