Relative Content

Tag Archive for pythonloops

Why does my loop append a string in reverse?

This is my code. My question is why do I need the “Horrible hack” paragraph. I know is can be much better written with a slice from the end with step -1 but my question is why is it needed at all.

Changing a loop system based on the system time to a simple time.sleep()

So I am trying to modify a code I had seen for a game… This is just a snippet of a larger code. I found it interesting though, this code uses OCR, it takes a screenshot and uploads a general overview to discord with the use of webhooks. I found out that the system it used was by reading my system (computer) time… I want to change this to a simpler way to create a loop to execute this part every “x” minutes. It reads for the system time and every time this includes either 300, 301, 302, 303 or 304 then it executes the function. I am having a little bit of trouble changing this to a simple time.sleep() function. I don’t know if it is related to the rest of the code influencing but this is the snippet:

I need to complete three different loops

I’m doing a fat burning heart rate and BMI calculator. It needs to account for incorrect inputs and loop back to request the correct input then move on to the next request for input.

Can someone please explain why this code doesn’t even run?

There is something wrong with the nested if statements in the code block, they are what is causing the code to not execute. I don’t know why this is happening. I’m a newbie at this so please keep that in mind when answering the question, we haven’t really studied too further in coding yet.