Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit c90b8d6

Browse files
Merge pull request #776 from Polqt/my-new-branch
Blind Auction by Pol Hidalgo
2 parents df0ecef + 805d1ae commit c90b8d6

File tree

11 files changed

+1036
-0
lines changed

11 files changed

+1036
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
import re
4+
import sys
5+
from flask.cli import main
6+
if __name__ == "__main__":
7+
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
8+
sys.exit(main())
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
import re
4+
import sys
5+
from charset_normalizer.cli.normalizer import cli_detect
6+
if __name__ == "__main__":
7+
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
8+
sys.exit(cli_detect())
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
import re
4+
import sys
5+
from replit.__main__ import cli
6+
if __name__ == "__main__":
7+
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
8+
sys.exit(cli())

projects/Blind Auction/.replit

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
entrypoint = "main.py"
2+
modules = ["python-3.10:v18-20230807-322e88b"]
3+
4+
hidden = [".pythonlibs"]
5+
6+
[nix]
7+
channel = "stable-23_05"
8+
9+
[unitTest]
10+
language = "python3"
11+
12+
[deployment]
13+
run = ["python3", "main.py"]
14+
deploymentTarget = "cloudrun"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":2,"languages":{"python-python3-poetry":{"specfileHash":"2d4d777e9c247f7151bfd5e9ce3ae966","lockfileHash":"a2a165a61ae2d57ed0868ca40de88728","guessedImports":["replit"],"guessedImportsHash":"2f1d64f65aaeefd4f2a4b8cf6714035c"}}}

projects/Blind Auction/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Blind Auction
2+
3+
Click "Open Preview" above to see this file rendered with the markdown.
4+
5+
# Instructions
6+
7+
The objective is to write a program that will collect the names and bids of different people. The program should ask for each bidder's name and their bid individually.
8+
9+
```
10+
Welcome to the secret auction program.
11+
What is your name?: Angela
12+
```
13+
```
14+
What's your bid?: $123
15+
```
16+
```
17+
Are there any other bidders? Type 'yes' or 'no'.
18+
yes
19+
20+
```
21+
If there are other bidders, the screen should clear, so you can pass your phone to the next person. If there are no more bidders, then the program should display the name of the winner and their winning bid.
22+
23+
```
24+
The winner is Elon with a bid of $55000000000
25+
```
26+
27+
Use your knowledge of Python dictionaries and loops to solve this challenge.
28+
29+
30+
# My console doesn't clear!
31+
32+
This will happen if you’re using an IDE other than replit (e.g., VSCode, PyCharm etc). Similar to how we used the "random" module previously, in this project we will use the "replit" module. The `clear()` function is available here via the replit module without any extra configuration.
33+
34+
**I’ll cover how to use PyCharm and import modules on Day 15**. That said, you can write your own `clear()` function or configure your IDE like so:
35+
36+
[Udemy Q&A Answer](https://www.udemy.com/course/100-days-of-code/learn/lecture/19279420#questions/16084076)
37+
38+
39+
# Solution
40+
41+
[https://replit.com/@appbrewery/blind-auction-completed](https://replit.com/@appbrewery/blind-auction-completed?v=1)

projects/Blind Auction/art.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
logo = '''
2+
___________
3+
\ /
4+
)_______(
5+
|"""""""|_.-._,.---------.,_.-._
6+
| | | | | | ''-.
7+
| |_| |_ _| |_..-'
8+
|_______| '-' `'---------'` '-'
9+
)"""""""(
10+
/_________\\
11+
.-------------.
12+
/_______________\\
13+
'''

projects/Blind Auction/main.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from replit import clear
2+
#HINT: You can call clear() to clear the output in the console.
3+
4+
from art import logo
5+
print(logo)
6+
7+
bids = {}
8+
bidding_finished = False
9+
10+
def find_highest_bidder(bidding_record):
11+
highest_bid = 0
12+
winner = ""
13+
for bidder in bidding_record:
14+
bid_amount = bidding_record[bidder]
15+
if bid_amount > highest_bid:
16+
highest_bid = bid_amount
17+
winner = bidder
18+
print(f"The winner is {winner} with a bid of ${highest_bid}.")
19+
20+
while not bidding_finished:
21+
name = input("What is your name? ")
22+
bid = int(input("What is your bid? $"))
23+
bids[name] = bid
24+
25+
should_continue = input("Are there any other bidders? Type 'yes' or 'no': ").lower()
26+
if should_continue == "no":
27+
find_highest_bidder(bids)
28+
bidding_finished = True
29+
elif should_continue == "yes":
30+
clear()
31+

projects/Blind Auction/poetry.lock

Lines changed: 887 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[tool.poetry]
2+
name = "python-template"
3+
version = "0.1.0"
4+
description = ""
5+
authors = ["Dr Angela Yu"]
6+
7+
[tool.poetry.dependencies]
8+
python = ">=3.10.0,<3.11"
9+
replit = "^3.5.0"
10+
11+
[tool.pyright]
12+
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md
13+
useLibraryCodeForTypes = true
14+
exclude = [".cache"]
15+
16+
[tool.ruff]
17+
# https://beta.ruff.rs/docs/configuration/
18+
select = ['E', 'W', 'F', 'I', 'B', 'C4', 'ARG', 'SIM']
19+
ignore = ['W291', 'W292', 'W293']
20+
21+
[build-system]
22+
requires = ["poetry-core>=1.0.0"]
23+
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)