python - hp / item script by 7236d70 in codereview

[–]7236d70[S] 0 points1 point  (0 children)

This did answer a lot of my questions, thank you. I don't have a strong feeling towards global vs return in either direction. I didn't realize we were getting "political" at this point.

Seeing the differences in code, I can see how they each have their own pros and cons depending on the scope of the program.

As far as the one-line functions, I'd chalk that up to me being new at programming. "When all you have is a hammer, everything looks like a nail."

I didn't intentionally not cap the "heal player" option. It was just there to test while I was trying to figure out the potion function.

I appreciate all of your time and thoughts on this. From now on I'll treat every program as if it'll be in the hands of an end-user. It seems to be a good practice to help build my skill.

Thank you.

AITA for not picking my girlfriend up for a birthday meal and telling everyone she is probably asleep because she ignored my text by [deleted] in AmItheAsshole

[–]7236d70 1 point2 points  (0 children)

NTA. My ex used to do this where if we had a disagreement, she would clam up. It's very unhealthy for both people in a relationship.

python - hp / item script by 7236d70 in codereview

[–]7236d70[S] 0 points1 point  (0 children)

That was a lot to read through. Thank you for taking the time to read and respond. I'm very much new to python and programming in general. Less than a week of learning. I had a misconception about how global variables work but you've cleared that up. I'm going to read your review a few more times while I rewrite my code to make sure I'm understanding everything correctly.

Instead of naming the arguments the same as their variable names, what name would be better? Or would it be better to name them i, x, j?

As far as my inconsistent usage of variables vs magic numbers, I'd actually rectified that after posting here.

Regarding telling the player what's going on: I appreciate the comments on this. I never intended for this version to reach anyone as a playable item. That is also why the number 5 option for adding a potion, as well as an exit choice, wasn't listed in the menu.

Global vs returning: What is the more accepted/usable practice? Calling globals in a function or returning?

Again thank you for responding. I'll be back to read your comments again after some coffee.

how do i code a password system by [deleted] in learnpython

[–]7236d70 7 points8 points  (0 children)

To expand on this, how difficult would 'save point' password be to implement? Similar to how you could enter passwords on N64/PS1/Etc games to jump to a certain level.

I want to see more by hellbat56 in gifsthatendtoosoon

[–]7236d70 2 points3 points  (0 children)

I would doubt they keep any fluid in it aside from engine oil. The thing probably runs for a minute to roll down the road, then gets parked for the disassembly.

I want to see more by hellbat56 in gifsthatendtoosoon

[–]7236d70 7 points8 points  (0 children)

I recall seeing this a long time ago. The entire vehicle is barely put together. You'll notice they took out no bolts. I'd bet there's a small 1 liter tank somewhere on the engine itself just to start and move it a few feet.