태지쌤

로봇 & 코딩교육 No.1 크리에이터

파이썬/exercise

9-3. python blind auction

태지쌤 2023. 1. 4. 18:01
반응형

replit에서 화면 초기화하는 방법 -> from replit import clear

from replit import clear
import art

print(art.logo)
dict = {}
flag = True

def find_result(bidding_record):
	highest = 0
	for bidder in bidding_record:
		bid_amount = bidding_record[bidder]
		if bid_amount > highest:
			highest = bid_amount
			winner = bidder
	print(f"winner is {winner}, money ${highest}")

while flag:
	name = input("What is your name? : ")
	bid = int(input("What's your bid?: $"))
	dict[name] = bid

	other = input("Are there any other bidders? Type 'yes' or 'no'")
	if other == "no":
		flag = False
		find_result(dict)
	else:
		clear()

for name in dict:
	dict[name]

반응형