Beginner In Python Need Help

Hi, I’m struggling with a lot of basic python variable codes and logic.
The question is in comments and my work follows there after. Thanks!

please do not post screenshots, post your actual code

I don’t see a question in the comments either, only a description of the problem. Is there something specific that’s not working?

The question is also in the png. It’s in grey comments (#).
I could try and figure it out by looking at the results, but the only result I get is “Process finished with exit code 0” (I know what that means), however, I don’t know if it’s a setting or something but how can I enable it to punch out my actual code results in the “Run” window instead of just “…exit code 0”? For instance if I type “print(“cat”)” I want to be able to see “cat” in the run window as a result.

I understand your question is about PyCharm specifically?

As of for your code, you are reusing the variable code . First, asking the user to input a code. After, in the for loop. Both if statements check the code IN the loop, not the user input.

Just by looking at your code, to me, the for loop is excessive. You need the user to input a code and then check with if statements.

if code == 1:
  # do Correspondence
elif code == 2:
  # do full-time
else:
  # print some error

If you wish to run this process for each of your 50 students you must move your input's inside the for loop, just above the if's. This way it will ask you for name, address and code 50 times, one for each student. ALSO, if you want this behaviour, rename the variable code of your loop to something else, like student.
Again, this will depend on the behaviour you want.
Bye!

Hi, I ended up just uninstalling pycharm to completely reset the settings and reinstalled, so it works now. However thanks a lot for the constructive feedback on my code itself! Cheers.

1 Like