Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: When is it safe to compare (==) two floats?
Post: RE: When is it safe to compare (==) two floats?

(Nov-11-2023, 07:51 PM)buran Wrote: have a look at decimal module from standard library. you are working with money, so always 2 decimal places I just tried it out and it seems to be doing the exact...
Radical General Coding Help 4 824 Nov-11-2023, 10:29 PM
    Thread: When is it safe to compare (==) two floats?
Post: When is it safe to compare (==) two floats?

I am writing a program that will automatically check & pay off the amount I owe on my credit card. Since it takes a few days to process payment, I am saving the value I owed to a .txt file on my P...
Radical General Coding Help 4 824 Nov-11-2023, 07:31 PM
    Thread: How to create a variable only for use inside the scope of a while loop?
Post: RE: How to create a variable only for use inside t...

(Nov-06-2023, 04:03 AM)deanhystad Wrote: I don't understand why you are pyautogui.move_to() or pyautogui.screenshot(). pyautogui.pixelMatchesColor() gets the pixel at the screen coordinates provide...
Radical General Coding Help 10 1,959 Nov-06-2023, 10:47 PM
    Thread: Which things are actually fun to code?
Post: Which things are actually fun to code?

I discovered coding through C++ game development and I immediately fell in love. Making the physics, the enemy AI, ability interactions, and just the immense amount of creative problem solving require...
Radical News and Discussions 0 587 Nov-05-2023, 10:25 PM
    Thread: How to create a variable only for use inside the scope of a while loop?
Post: RE: How to create a variable only for use inside t...

Yeah I was trying to avoid what you did there. (creating the variable at the global scope). I never found a way, but I found a "workaround" per-se, by putting it inside of a function. That way the var...
Radical General Coding Help 10 1,959 Nov-05-2023, 09:32 PM
    Thread: How to create a variable only for use inside the scope of a while loop?
Post: How to create a variable only for use inside the s...

This should be a very basic question. The code I'm using right now is: timeOut = 0 while not x == 5: time.sleep(1) timeOut += 1 if timeOut > 120: exit()which gets the job done,...
Radical General Coding Help 10 1,959 Nov-05-2023, 07:37 PM
    Thread: regex findall() returning weird result
Post: regex findall() returning weird result

EDIT: You can likely just skip to the "update" at the bottom of this post. What I am trying to do is test out regular expression usage to find a phone number in a string (accounting for multiple writ...
Radical General Coding Help 1 709 Oct-15-2023, 05:12 PM
    Thread: It's saying my global variable is a local variable
Post: It's saying my global variable is a local variable

EDIT: Okay I found this video that explains the issue well: https://www.youtube.com/watch?v=qsf_pM9Ge_g but this issue does not exist in C++. So what is different about Python? I was creating a littl...
Radical General Coding Help 5 1,255 Sep-30-2023, 06:34 PM
    Thread: No matter what I do I get back "List indices must be integers or slices, not list"
Post: RE: No matter what I do I get back "List indices m...

It returns what I expected. "y" is a list with 6 strings inside. I figured that it would loop through the items in "y" the same way it looped through the different lists in "grid". UPDATE: Wait..... ...
Radical General Coding Help 4 1,304 Sep-23-2023, 06:04 PM
    Thread: No matter what I do I get back "List indices must be integers or slices, not list"
Post: No matter what I do I get back "List indices must ...

EDIT: Solved I'm having an issue with my code, and Google seems to think it's a simple fix, but I've been trying the fixes and they aren't working. I don't understand why it doesn't work. (The goal o...
Radical General Coding Help 4 1,304 Sep-23-2023, 05:25 PM
    Thread: for loops break when I call the list I'm looping through
Post: for loops break when I call the list I'm looping t...

I was trying out the for loops in Python, and I don't fully understand why it breaks. When I type: for i in catNames: print(catNames[i])the program breaks. but when I type: for i in catNames: ...
Radical General Coding Help 4 969 Sep-17-2023, 04:42 PM
  Exclamation Thread: C++ programmer confused about why Python isn't working the way I intend
Post: RE: C++ programmer confused about why Python isn't...

Thanks for the detailed breakdown
Radical General Coding Help 2 794 Sep-15-2023, 04:21 AM
    Thread: C++ programmer confused about why Python isn't working the way I intend
Post: C++ programmer confused about why Python isn't wor...

So I just started learning Python a few days ago and have written a very simple block of code, but it doesn't do what I think it would. Can you please walk me through what is actually happening here w...
Radical General Coding Help 2 794 Sep-14-2023, 04:56 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020