This post says the following should work:
import os
os.system('cls||clear')
Why doesn’t it work in the following code? It works when applied in the terminal but not in the script:
import os
def highest_bidder(bidders):
highest = 0
for key in bidders.keys():
if bidders[key] > highest:
high_bidder = {}
high_bidder[key] = bidders[key]
highest = bidders[key]
return high_bidder
bidders = True
bids = {}
while bidders:
name = input("what is your name? ")
bid = int(input("What is yourt bid? "))
bids[name] = bid
more_bidders = input("Are there more bidders (yes, no)? ")
os.system('clear||cls')
if more_bidders == 'no':
bidders = False
high_bidder = highest_bidder(bids)
for key in high_bidder.keys():
print(f'{key} is the high bidder with a bid of {high_bidder[key]}')