If we assign false to a variable and then use a while not loop, why is the variable still false and not true?

if we assign false to a variable and then use a while not loop, why is the variable still false and not true?

Because you did not change its value.

While not x: does not change x.

i mean if it is while not false, then it should be true right?

Yes.

If this is not working share code for us to comment on.
remember to quote the code.

There is some ambiguity because ‘false’ and False are pretty different:

>>> i = 'false'
>>> bool(i)
True
>>> i = False
>>> bool(i)
False

Good to know: Truth Value Testing

If you have this code:

x = 0
while x + 10 > 5:
    print(x)

what does it print? After the loop is finished, what value will x have?

You ask: “if it is while not false, then it should be true right?”

No. Change the while to if:

flag = False
if not flag:
    print(flag)  # prints False because the variable "flag" is False

Of course this prints False because you haven’t changed the variable. The variable is False because you set it to False with the line flag = False, and the if ... doesn’t change the value of the variable.

while is the same as if, except it runs a loop. It doesn’t change the value of the variable either.

Just because you look at the condition not flag doesn’t magically
flip the flag variable from False to True, any more than

x = -10
while -x > 0:
    print(x)

magically flips the x variable from -10 to 10.

If you want to change the variable, you have to actually change the variable.

auction = {}
bidding_finished = False
def find_highest_bidder(bidding_record):
  highest_bid = 0
  winner = ""
  for bidder in bidding_record:
    bid_amount = bidding_record[bidder]
    if bid_amount > highest_bid:
      winner = bidder
  print(f"The winner is {winner} with a bid of ${highest_bid}")
    
while not bidding_finished:
  name = input("What is your name?: ")
  bid = int(input("What is your bid?: $"))
  auction[name] = bid
  more = input("Is there anyone else? If yes type 'yes', if no type 'no'\n")
  if more == "no":
    bidding_finished = True
    find_highest_bidder(auction)
  elif more == "yes":
    clear()

This is the code i was working with, here bidding_finished = False, but when i use the while not loop, it should have been True right? That’s the part don’t understand.

What is the “it” that should be true?
Are you asking if the while expression is true?
It is true because you set bidding_finish to False at the start.

Later the while expression is False after you set bidding_finished to True.

nope my question is that i have set bidding_finished to False at the starting, so if i use a while loop then bidding_finished = False but if i use a while not loop then the bidding_finished should be True right? but why is it showing False

For example let’s say that something is false, if i say while not something then that means while not this is False (which means it is True).

Maybe the issue is that you are trying to read this as English, rather then as logical code.

Your code is while not bidding_finished:
At this point in the code, bidding_finished is already set as False. This is effectively a double negative, which will always result in a positive outcome: meaning the while loop will execute until such a time when bidding_finished is set to True

Operators do not modify variables in-place.

Consider:

x = 0
x + 1

What is the value of x at the end of this script? It is 0, because the result of the addition on the second line is not stored anywhere. To update the value of x, you have to do x = x + 1.

Similarly:

x = False
not x

What is the value of x at the end of this script? It is False, for the same reason as above. In order for x to become True, you would need to store the result of the last line: x = not x.

The result of the not bidding_finished condition in the while loop is not stored. Therefore, bidding_finished keeps its original value, False, until the program reaches the line where it is explicitly set to True.

The important part of your code, with comments added:

# You set the variable "bidding_finished" to False.
bidding_finished = False

# Here you test in a while loop:
# - If `bidding_finished` is **True** then `not bidding_finished` 
#       must be False, and we jump past the while loop.
# - If `bidding_finished` is **False** then `not bidding_finished` 
#       must be True, and we run the while block.
while not bidding_finished:
    # The test does NOT change the value of the variable.
    # If `not bidding_finished` is True, so that we enter the loop,
    # then `bidding_finished` must be False.
    # It stays False because nothing changes the value of the
    # variable yet.
    ...
    ...
    # More code runs.
    ...
    ...
    if more == "no":
        # Finally you change the value of the variable.
        bidding_finished = True
    ...
    # and we go back to the start of the loop.

ok so

auction = {}
bidding_finished = False
def find_highest_bidder(bidding_record):
  highest_bid = 0
  winner = ""
  for bidder in bidding_record:
    bid_amount = bidding_record[bidder]
    if bid_amount > highest_bid:
      winner = bidder
      highest_bid = bid_amount
  print(f"The winner is {winner} with a bid of ${highest_bid}")
    
while not bidding_finished:
  name = input("What is your name?: ")
  bid = int(input("What is your bid?: $"))
  auction[name] = bid
  more = input("Is there anyone else? If yes type 'yes', if no type 'no'\n")
  if more == "no":
    bidding_finished = True
    find_highest_bidder(auction)
  elif more == "yes":
    clear()

this code and the code below are the same right?

auction = {}
bidding_finished = True
def find_highest_bidder(bidding_record):
  highest_bid = 0
  winner = ""
  for bidder in bidding_record:
    bid_amount = bidding_record[bidder]
    if bid_amount > highest_bid:
      winner = bidder
      highest_bid = bid_amount
  print(f"The winner is {winner} with a bid of ${highest_bid}")
    
while bidding_finished:
  name = input("What is your name?: ")
  bid = int(input("What is your bid?: $"))
  auction[name] = bid
  more = input("Is there anyone else? If yes type 'yes', if no type 'no'\n")
  if more == "no":
    bidding_finished = False
    find_highest_bidder(auction)
  elif more == "yes":
    clear()

the while not loop threw me off a little bit, it’s easier for me to understand the logic if i use a while loop in place of the while not loop

I suggest you rename your variable from bidding_finished to bidding_still_running (or something similar):

bidding_still_running = True

while bidding_still_running:
    ...

yeahhh, i just changed the code in a hurry to understand the logic behind it