Test/Python(20220101~)

Days9_**비밀경매 프로그램

kiostory 2022. 1. 14. 22:35
from art import logo #텍스트 아트를 별도의 art.py에 logo 변수로 두고 읽어왔음
from replit import clear #화면 지우기의 일반적인 함수를 모르겠음
print(logo)
print("Welcome to the secret auction program.")
bidding = {}   #딕셔너리와 리스트/딕셔너리, 리스트간 무엇을 사용할지 결정하는데 시간소비함
repeat = True
while repeat:
    ones_name = input("What is your name?: ")
    ones_bid = int(input("What's your bid?: $"))
    bidding[ones_name] = ones_bid
    if input("Are there any other bidders? Type 'yes' or 'no'.") == "no":
        repeat = False
    else:
        clear()
max_bid = 0
for key in bidding:
    if bidding[key] > max_bid:
        winner_name = key
        max_bid = bidding[key]
print(f"The winner is {winner_name} with a bid of ${max_bid}.")