Created a secret auction simulator!

Focuses:
- Dictionaries
- Nesting dictionaries and lists
- Retrieving data from dictionaries/lists, editing data, appending data, clearing data
This commit is contained in:
Mueez Khan 2021-01-11 22:59:09 -05:00 committed by GitHub
parent 48bb9078b7
commit 550cce39fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

13
Day 9/art.py Normal file
View file

@ -0,0 +1,13 @@
logo = '''
___________
\ /
)_______(
|"""""""|_.-._,.---------.,_.-._
| | | | | | ''-.
| |_| |_ _| |_..-'
|_______| '-' `'---------'` '-'
)"""""""(
/_________\\
.-------------.
/_______________\\
'''

25
Day 9/secret-auction.py Normal file
View file

@ -0,0 +1,25 @@
from art import logo
print(logo)
print("Welcome to the secret auction program.")
bid_dict = {}
def new_bid():
name = input("What is your name?: ")
bid = input("What's your bid?: $")
bid = float(bid)
bid_dict[name] = bid
end_check = input("Are there any other bidders? Type 'yes' or 'no'.")
if end_check == "yes":
new_bid()
elif end_check == "no":
highest_bid = bid
highest_bidder = name
for bidder in bid_dict:
if bid_dict[bidder] > highest_bid:
highest_bid = bid_dict[bidder]
highest_bidder = bidder
print(f"The winner is {highest_bidder} with a bid of ${highest_bid}.")
return
new_bid()