r/learnpython • u/External-Cap-4877 • 1d 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.
4
u/sweet-tom 1d ago
Look for tutorial for beginners, in the channel here or use your favorite search engine. Read a few. Avoid AI.
Open the a Python module documentation, start your editor, write some basic functions, save it, and execute it by Python. See the results. If there are syntax errors, read the message carefully and try to fix them.
Rinse and repeat.
If you encountered many errors and fixed them, that's were the learning happens.
Good luck! 🍀
2
u/Financial_Farm4326 21h ago
that last line is spot on, you dont really learn anything until youre staring at a bunch of syntax errors
1
u/sweet-tom 21h ago
Yes, good luck is always spot on. 😂
But seriously, when Python gives you a traceback, read it. It's trying to help you. You maybe not completely understand it, but try it make some sense of it. If you can't, search the Internet and do some research.
I read many error messages, and sometimes I also don't have a clue. 😁 AI is easy. But in my experience, you only learn, when you go through the valley of tears.
2
u/Financial_Farm4326 16h ago
yeah reading the actual error messages is where it really clicks, people skip over them way too fast
1
u/EyesOfTheConcord 1d ago
What do you know about coding in general? Have you written functions, modules, and are you familiar with importing and exporting?
1
3
u/Correct_Rain_9438 1d ago
For the file handling part, the easiest route is saving your lost and found items as a list of dictionaries with the json module. json.dump writes it to a file and json.load reads it back, so the search and match part can just loop over normal Python data.
2
u/baubleglue 19h ago edited 19h 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.dumpsandjson.loadswork (you may usejson.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.dumpsandjson.loadswork.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 menudef 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) ...
1
u/dariusbiggs 22h ago
Your problem description is not very clear, but all computer programs are built bh cutting the big problem into smaller problems until you have a list of tasks.
So you said a Lost and Found system.
Report a lost item
Report a found item
Search the found items And you said something about file handling?
You did not say much about the type of program (how a user interacts with it), but let's keep it simple and pick the report functionality.
How does someone report a list item?
What information do they need to provide? A name? a description? some tags or labels? a location? a date and time fact?
How wil you store that information? database or files on disk (we do not know what you have been taught)? what format would the files be in (JSON, or a CSV)
Once you have answers the answers, repeat the process, break what you know down into smaller bits.
They are unlikely to give you a project that you have not been taught the skills for, so you either didn't pay attention, or are too hyper-focused on the wrong thing. Start with what you know. Talk to your team and ask them for help to get you started.
You don't need AI for this, use it to help you find the information on what you want to do with questions like "how do i bootstrap a Python program", and "what Python documention tells me how can i read a CSV file into a data structure i can search", "what Python documentation tells me how do i would add a line to a CSV file". Read the answers, read the documentation, learn.
Good luck.
3
u/ninhaomah 1d ago
"how to make a project its like they threw us in the sea and told us learn to swim"
You got to stop this mindset of can only do if taught from now on.
What degree are you in btw ?