r/learnpython • • 8d ago

Final project

Hi, so i have a final project in uni so im first year student and we take python on semester 1 and the prof made us choose whatever it just need to be in python only and each oneh as 5 functions

so me and my team picked lost and found system which we didnt know anything about it
so its includes a report a lost item part and report a found item part and search and match part and the file handling

i swear this stuff is harder than it seemed we dont take in uni how to make a project its like they threw us in the sea and told us learn to swim
and now i feel so overwhelmed there is alot of stuff that idek how to do
starting from how do we even start to how to work together and how does the program should look like

so i asked ai to give me a sample of what my part should look like which is the file handling and the search and match it gave some complicated stuff that i cant even understand and the project should be done in 4 weeks maybe less

so i wanted to ask how do i do the project without ai and actually understand what the actuall fuck is going on.

3 Upvotes

15 comments sorted by

View all comments

3

u/baubleglue 8d ago edited 8d ago

I see 3 items, not 5

  • report a lost item
  • report a found item
  • search and match

you need to define

  • actions
  • data structures

If you know Python basics, you probably know about dictionaries, lists, maybe even classes. Read about JSON format if you don't know what it is. (it is basically conversion of Python data types into text and vice versa. You can use pickle exactly the same way, but is a but harder to read for human.

  • understand how json.dumps and json.loads work (you may use json.dump and json.load).

  • implement functionsdef save_item_collection_to_file(file_path, I see 3 items, not 5

  • report a lost item

  • report a found item

  • search and match

you need to define

  • actions
  • data structures

If you know Python basics, you probably know about dictionaries, lists, maybe even classes. Read about JSON format if you don't know what it is. (it is basically conversion of Python data types into text and vice versa. You can use pickle exactly the same way, but is a but harder to read for human.

  • understand how json.dumps and json.loads work.
  • implement functions
import uuid
def make_new_lost_item(item_name, item_description, contact_info, lost_date=None):
    return {"id": str(uuid.uuid1()), "name": item_name, "description": item_description, "contact_info": contact_info, "lost_date": lost_date, "status": "lost", "found_item_id": None}

def make_new_found_item(item_name, item_description, found_date=None):
    return {"id": str(uuid.uuid1()), "name": item_name, "description": item_description, "found_date": found_date, "status": "found", "lost_item_id": None}

def save_item_collection_to_file(file_path, item_collection):

def read_item_collection_from_file(file_path):
    ...
    return item_collection

def register_found_item_to_list(item_collection, item):
    # item_collection.append(item)
    # save_item_collection_to_file

def update_found_item_status(item_collection, item_id, status, lost_item_id=None):
def update_lost_item_status(item_collection, item_id, status, lost_item_id=None):

def serach_found_item_by_name(
def serach_found_item_by_description(
def list_found_items(
def list_lost_items

* than make few global variables

LOST_ITEMS_FILE_PATH  
FOUND_ITEMS_FILE_PATH

LOST_ITEMS_LIST  
FOUND_ITEMS_LIST

* than test functions one by one (make test.py)
* than make menu

def menu_ask_to_choose_activity(): ## register found item, register lost item, register returned item, exit ... return activity

def get_from_user_lost_item_details(): ...

CHOICES = {1: "register found item", 2: "register lost item", 3: "register returned item", 4: "exist"} EXIST = False while not EXIST: choice = menu_ask_to_choose_activity() if choice == 4: save_item_collection_to_file(LOST_ITEMS_FILE_PATH, LOST_ITEMS_LIST) save_item_collection_to_file(FOUND_ITEMS_FILE_PATH, FOUND_ITEMS_LIST) EXIST = True elif choice == 2: item_name, item_description, contact_info, lost_date = get_from_user_lost_item_details() lost_item = make_new_lost_item(item_name, item_description, contact_info, lost_date=None) ...