Jan-16-2023, 07:18 PM
When I post, I make a copy and cut away anything not directly related to the problem. Quite often the act of preparing code to post reveals the source of my problem. This step is always worth doing.
Not to be mean, but the code in your last post is worthless. Not only is there no way I can run this code, but it doesn't even include any reference to your earlier posts. Where in this method did you put an if statement that should block out some code? Even if you don't post code I can run, it would be useful to see you if statement in the context of the code where it is used.
To demonstrate how I go about authoring a post I will assume this is some code I wrote. and I am having problems with this part:
I don't think all that is required in this case, but could you point out where you were putting your if statement. Preferrably editing the code to include the if statement that isn't acting like an if statement?
Not to be mean, but the code in your last post is worthless. Not only is there no way I can run this code, but it doesn't even include any reference to your earlier posts. Where in this method did you put an if statement that should block out some code? Even if you don't post code I can run, it would be useful to see you if statement in the context of the code where it is used.
To demonstrate how I go about authoring a post I will assume this is some code I wrote. and I am having problems with this part:
if len(data) > 0: student.datadict.add(cl_note.date, data) else: continueI copy the method, provide just enough structure to run it, and cut out everything I don't need. I end up with something like this:
class Stuff: def getNotesByStudent(self): student = {} first_entry_done = False for cl_note in "ABC": for seat_num in [1]: data = {} if True: if not first_entry_done: data = {"key": "value"} first_entry_done = True if len(data) > 0: student.update(data) else: continue return student print(Stuff().getNotesByStudent())If this demostrates my problem, I post the code, describe what it is supposed to do, describe what it is doing, and provide any instructions needed to make the code demonstrate the odd behavior. I also list what I have done to try and diagnose the problem.
I don't think all that is required in this case, but could you point out where you were putting your if statement. Preferrably editing the code to include the if statement that isn't acting like an if statement?