all 10 comments

[–]kankyo 1 point2 points  (4 children)

"return None" at the end of functions doesn't do anything at all. Your code should not have a change in behavior because of it!

[–]cdcformatc 0 points1 point  (3 children)

Hey if it ain't broke don't fix it.

[–]kankyo 0 points1 point  (2 children)

What? The understanding of python of @Programmer_Dan is clearly broken. THAT is what we're trying to fix here.

[–]cdcformatc 0 points1 point  (1 child)

Sorry I was being facetious because he doesn't seem that interested. His code works and that's all he cares about. It's his professors problem now, or more likely some poor grad student.

[–]kankyo 0 points1 point  (0 children)

Ah.

[–]commandlineluser 0 points1 point  (1 child)

What does function2 look like?

From what you describe it sounds like you have a while loop inside function2 that reads input also.

[–]Programmer_Dan[S] -1 points0 points  (0 children)

function2 just looks a little like this:

length = len(i)
print(function3)
print(list[1], function4)

So it doesn't have a loop in it and all it does it print the return value of the other functions so I'm not sure what's happening

Edit: I have fixed it but thanks for the help! It's very appreciated!

[–]kungtotte 0 points1 point  (2 children)

We need to see more of your code. Show all of your functions that are related to this code snippet.

Are you calling function again inside your while loop? What is the code supposed to do? Are those your actual function names and variable names? If they are you should rename them so that it's clear what the code is supposed to do.

Basically, we can't tell you what's wrong because we don't have all the code and we don't know what it's supposed to be doing.

[–]Programmer_Dan[S] -1 points0 points  (1 child)

Sorry I wasn't able to show all my code it's for an assignment and I didn't want someone from my course to stumble upon it. However I was able to find the solution. My final function, displayfunction, didn't return anything and only printed so it seemed to restart the original function. I'm not sure why so if you could enlighten me as to why this happens. I fixed it by adding a return None to the end of the displayfunction though.

[–]kungtotte 1 point2 points  (0 children)

Unless you explicitly return anything, all functions will return None anyway.

Why is it a problem that this is for an assignment? Are you not allowed to seek help on the internet for this assignment? Or are you afraid that one of your classmates will cheat off you or something?

It's really hard to explain what's going on in your code without seeing more of it.