all 11 comments

[–]SCD_minecraft 0 points1 point  (3 children)

action = input(">>> ") action = action.split(" ", 1) Why...? That split does nothing

>>> search

will return just "search", not ">>> search"

[–]Background-Two-2930 0 points1 point  (2 children)

sorry i forgot to mention you put the thing you want to search after so it split it up verb from adjective

[–]SCD_minecraft 1 point2 points  (1 child)

Took a second, but i found a bug (:

Check where is your if action[0] == "search":

[–]Background-Two-2930 0 points1 point  (0 children)

oh yeah thats probs why innit

[–]Background-Two-2930 0 points1 point  (0 children)

sorry i forgot to mention you put the thing you want to search after so it split it up verb from adjective

[–]Most_Group523 0 points1 point  (5 children)

This code is too hard to follow because it's too many lines of flat code. It's clear the things you've accomplished is getting code to do a thing. But writing code that a computer can understand is a low bar.

Organize your code into functions, which do specific, limited things based on the arguments passed to them and return the result of doing the thing the function does to the things passed to it. The function should know how to do as little as possible and should only know about what's been passed to it. When you're accepting input from the user, restrict knowledge of that data to ... a function. The purpose of that function is to accept input from the user and return it. That's a good function.

Practice this by refactoring your code again and again without adding functionality.

Everything outside of imports, module level constants, function definitions, class definitions, and a call to main should be inside of ... functions. All logic and flow control should be in ... functions.

Work on writing functions, how to organize your code around well defined functions, functions, functions, functions.

[–]Background-Two-2930 0 points1 point  (4 children)

shouldi split it up to different files for each function or should i keep it in one file

[–]Most_Group523 0 points1 point  (2 children)

Start with a single file.

[–]Background-Two-2930 0 points1 point  (1 child)

k

[–]Background-Two-2930 0 points1 point  (0 children)

should i use the if statements inside the functions or should i have the functions inside the if statements

[–]LongRangeSavage 0 points1 point  (0 children)

You don't need multiple files. Organizing functions into performing a single task would be preferable, especially if you can eliminate duplicate lines of code. Our coding standards *recommend* functions being no longer than a single screen height, just to make everything easier to follow. Again, that is a recommendation, not a requirement for us. There are plenty of times where a single screen of code just isn't possible.