Day 6-7 May 23-24th, 2022

·

1 min read

Put on my big girl pants and did some work with dictionaries yesterday and today. Made an auction program. This one took a minute. It's mostly the order of where to put things that gets me. I tend to get the variables and knowing when to make a new one mixed up/ I'll probably watch the video again to make sure I get this stuff down pat. I've decided to just start pasting the code here. I think it looks nice

from art import logo
print(logo)


bidder = {}
bidding_finished = False
bidding_record = {}

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:
            winningbid = bidder
    print(f"The winner is {winningbid} with a bid of ${highest_bid} ")

while not bidding_finished:
    biddername = input("What is your name? ")
    bidderprice = int(input("What is your bid? $"))
    bidder[biddername] = bidderprice
    wannacontinue = input("Is there another bidder? Type \'Yes\' or \'No\'. ").lower()
    if wannacontinue == "no":
        bidding_finished = True
        find_highest_bidder((bids))
    elif wannacontinue == "yes":
        wannacontinue = False
        clear()