-
Notifications
You must be signed in to change notification settings - Fork 679
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #776 from Polqt/my-new-branch
Blind Auction by Pol Hidalgo
- Loading branch information
Showing
11 changed files
with
1,036 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
import re | ||
import sys | ||
from flask.cli import main | ||
if __name__ == "__main__": | ||
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
import re | ||
import sys | ||
from charset_normalizer.cli.normalizer import cli_detect | ||
if __name__ == "__main__": | ||
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) | ||
sys.exit(cli_detect()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
import re | ||
import sys | ||
from replit.__main__ import cli | ||
if __name__ == "__main__": | ||
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) | ||
sys.exit(cli()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
entrypoint = "main.py" | ||
modules = ["python-3.10:v18-20230807-322e88b"] | ||
|
||
hidden = [".pythonlibs"] | ||
|
||
[nix] | ||
channel = "stable-23_05" | ||
|
||
[unitTest] | ||
language = "python3" | ||
|
||
[deployment] | ||
run = ["python3", "main.py"] | ||
deploymentTarget = "cloudrun" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":2,"languages":{"python-python3-poetry":{"specfileHash":"2d4d777e9c247f7151bfd5e9ce3ae966","lockfileHash":"a2a165a61ae2d57ed0868ca40de88728","guessedImports":["replit"],"guessedImportsHash":"2f1d64f65aaeefd4f2a4b8cf6714035c"}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
## Blind Auction | ||
|
||
Click "Open Preview" above to see this file rendered with the markdown. | ||
|
||
# Instructions | ||
|
||
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. | ||
|
||
``` | ||
Welcome to the secret auction program. | ||
What is your name?: Angela | ||
``` | ||
``` | ||
What's your bid?: $123 | ||
``` | ||
``` | ||
Are there any other bidders? Type 'yes' or 'no'. | ||
yes | ||
``` | ||
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. | ||
|
||
``` | ||
The winner is Elon with a bid of $55000000000 | ||
``` | ||
|
||
Use your knowledge of Python dictionaries and loops to solve this challenge. | ||
|
||
|
||
# My console doesn't clear! | ||
|
||
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. | ||
|
||
**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: | ||
|
||
[Udemy Q&A Answer](https://www.udemy.com/course/100-days-of-code/learn/lecture/19279420#questions/16084076) | ||
|
||
|
||
# Solution | ||
|
||
[https://replit.com/@appbrewery/blind-auction-completed](https://replit.com/@appbrewery/blind-auction-completed?v=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
logo = ''' | ||
___________ | ||
\ / | ||
)_______( | ||
|"""""""|_.-._,.---------.,_.-._ | ||
| | | | | | ''-. | ||
| |_| |_ _| |_..-' | ||
|_______| '-' `'---------'` '-' | ||
)"""""""( | ||
/_________\\ | ||
.-------------. | ||
/_______________\\ | ||
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from replit import clear | ||
#HINT: You can call clear() to clear the output in the console. | ||
|
||
from art import logo | ||
print(logo) | ||
|
||
bids = {} | ||
bidding_finished = False | ||
|
||
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: | ||
highest_bid = bid_amount | ||
winner = bidder | ||
print(f"The winner is {winner} with a bid of ${highest_bid}.") | ||
|
||
while not bidding_finished: | ||
name = input("What is your name? ") | ||
bid = int(input("What is your bid? $")) | ||
bids[name] = bid | ||
|
||
should_continue = input("Are there any other bidders? Type 'yes' or 'no': ").lower() | ||
if should_continue == "no": | ||
find_highest_bidder(bids) | ||
bidding_finished = True | ||
elif should_continue == "yes": | ||
clear() | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[tool.poetry] | ||
name = "python-template" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Dr Angela Yu"] | ||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.10.0,<3.11" | ||
replit = "^3.5.0" | ||
|
||
[tool.pyright] | ||
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md | ||
useLibraryCodeForTypes = true | ||
exclude = [".cache"] | ||
|
||
[tool.ruff] | ||
# https://beta.ruff.rs/docs/configuration/ | ||
select = ['E', 'W', 'F', 'I', 'B', 'C4', 'ARG', 'SIM'] | ||
ignore = ['W291', 'W292', 'W293'] | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"error":".zip archives do not support non-regular files","level":"error","msg":"unable to write file .cache/replit/modules/python-3.10","time":"2024-08-01T13:42:25Z"} | ||
{"error":".zip archives do not support non-regular files","level":"error","msg":"unable to write file .cache/replit/modules/replit","time":"2024-08-01T13:42:25Z"} |