Compare commits
9 Commits
example
...
850a8adc84
Author | SHA1 | Date | |
---|---|---|---|
850a8adc84 | |||
8be959c68f | |||
0f936057dc | |||
a6d5edd004 | |||
744d3e8a99 | |||
23fe675c08 | |||
d63f25b4f7 | |||
d3d782b419 | |||
c0e4f76170 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,2 +1,5 @@
|
|||||||
.ipynb_checkpoints
|
.ipynb_checkpoints
|
||||||
Pifile.lock
|
Pipfile.lock.local/
|
||||||
|
.jupyter
|
||||||
|
.ipython
|
||||||
|
.local
|
||||||
|
9
Dockerfile
Normal file
9
Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
FROM python:slim
|
||||||
|
|
||||||
|
ENV TOKEN=''
|
||||||
|
|
||||||
|
WORKDIR /notebooks
|
||||||
|
RUN useradd -d /notebooks python && chown -R python /notebooks && pip install jupyterlab
|
||||||
|
|
||||||
|
USER python
|
||||||
|
CMD [ "jupyter", "lab", "--ip=0.0.0.0", "--NotebookApp.token=''", "--notebook-dir", "/notebooks", "picofumi.ipynb" ]
|
4
Pipfile
4
Pipfile
@@ -5,6 +5,7 @@ name = "pypi"
|
|||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
jupyterlab = "*"
|
jupyterlab = "*"
|
||||||
|
watchgod = "*"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
|
|
||||||
@@ -12,4 +13,5 @@ jupyterlab = "*"
|
|||||||
python_version = "3.9"
|
python_version = "3.9"
|
||||||
|
|
||||||
[scripts]
|
[scripts]
|
||||||
jupyter = "jupyter lab --notebook-dir notebooks notebooks/picofumi.ipynb"
|
jupyter = "jupyter lab --notebook-dir notebooks notebooks/picofumi.ipynb"
|
||||||
|
watch = "watchgod src.main.main"
|
||||||
|
43
README.md
43
README.md
@@ -1,3 +1,44 @@
|
|||||||
# PicoFumi
|
# PicoFumi
|
||||||
|
|
||||||
A Python Tutorial app
|
A Python Tutorial app
|
||||||
|
|
||||||
|
|
||||||
|
## Installing Python
|
||||||
|
You will need Python 3.9
|
||||||
|
|
||||||
|
## Window
|
||||||
|
Either get it on the Microsoft Store or down load it [here](https://www.python.org/ftp/python/3.9.8/python-3.9.8-amd64.exe)
|
||||||
|
|
||||||
|
## Apt
|
||||||
|
|
||||||
|
```sudo apt install python3.9 python3-pip```
|
||||||
|
|
||||||
|
## Yum
|
||||||
|
|
||||||
|
```sudo yum install python3.9 python3-pip```
|
||||||
|
|
||||||
|
## Mac
|
||||||
|
|
||||||
|
Download it [here](https://www.python.org/ftp/python/3.9.8/python-3.9.8-macos11.pkg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Install pipenv
|
||||||
|
|
||||||
|
On Windows open Powershell
|
||||||
|
On Linux or Mac open the terminal
|
||||||
|
|
||||||
|
```pip install pipenv```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```pipenv lock```
|
||||||
|
|
||||||
|
```pipenv sync```
|
||||||
|
|
||||||
|
|
||||||
|
## Run Jupyter
|
||||||
|
|
||||||
|
```pipenv run jupyter```
|
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
image: picofumi
|
||||||
|
ports:
|
||||||
|
- 8888:8888
|
||||||
|
volumes:
|
||||||
|
- ./notebooks:/notebooks
|
||||||
|
environment:
|
||||||
|
- TOKEN=a
|
@@ -7,11 +7,507 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"# Pico Fumi"
|
"# Pico Fumi"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 25,
|
||||||
|
"id": "d8f95dd9-11ad-455d-854a-86a12d84fbda",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdin",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Enter a three digit number: 123\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"1 2 3 \n",
|
||||||
|
" \n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdin",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Enter a three digit number: 456\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"4 5 6 \n",
|
||||||
|
" P \n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdin",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Enter a three digit number: 789\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"7 8 9 \n",
|
||||||
|
" F \n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdin",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Enter a three digit number: 588\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"5 8 8 \n",
|
||||||
|
"F F P \n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdin",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Enter a three digit number: 585\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"5 8 5 \n",
|
||||||
|
"F F P \n",
|
||||||
|
"\n",
|
||||||
|
"You loose!\n",
|
||||||
|
"5 8 0 "
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"%run picofumi.py"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "f97654b6-de87-4a5a-9dfb-e32eac6b62cd",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## Printing"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 10,
|
||||||
|
"id": "0046af84-de64-4023-bdf5-335177caf22a",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Pico Fumi\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"print(\"Pico Fumi\")"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "ce8f228c-dbb3-4b49-87ea-2234d283f49d",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## Variables"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 13,
|
||||||
|
"id": "781cbd75-5b16-4740-ac88-fda9672bcdbd",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"123\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"guess = \"123\"\n",
|
||||||
|
"print(guess)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 14,
|
||||||
|
"id": "b41186fa-ff8a-4e5e-ba55-1c9450a5c9af",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"0\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"guesses = 0\n",
|
||||||
|
"print(guesses)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "4304923b-cbc9-48ca-9ee8-766487115c2f",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## Get User Input"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"id": "3adeee26-8a18-4bad-946b-3d06920ef82f",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdin",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Enter a three digit number: 123\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"guess = input(\"Enter a three digit number:\")"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 16,
|
||||||
|
"id": "ec055f06-6fdd-4ab9-bce2-d56c82093c4b",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"123\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"print(guess)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "6e3fa703-3f5f-4622-b8f5-349f61371282",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## Break guess into 3 parts"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 17,
|
||||||
|
"id": "7e1a2228-3316-4652-9051-70c355de94bb",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"['1', '2', '3']\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"guess = list(guess)\n",
|
||||||
|
"print(guess)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "ccd7b9d1-c266-498e-9f46-63c522c4d332",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## Itterate over the parts"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 26,
|
||||||
|
"id": "ddca84c9-2fff-4302-afd0-7096649bcdc7",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"5\n",
|
||||||
|
"8\n",
|
||||||
|
"5\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"for part in guess:\n",
|
||||||
|
" print(part)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "77ab1ca2-0ea0-43b3-b6bd-d4438fa8141d",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## Random Numbers"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 27,
|
||||||
|
"id": "f4412eef-6b79-4329-b8e7-85f916d3dfbf",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import random \n",
|
||||||
|
"random.seed()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "c9324728-63c2-4023-92fc-3e1e80dff03a",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"number = random.randrange(100,999)\n",
|
||||||
|
"print(number)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"id": "6194de2b-2dbe-4c49-bc00-e5bed3c35f1f",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"finished = False"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 7,
|
||||||
|
"id": "e6e0b1c2-7c4b-4538-8421-bfdd027b1857",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdin",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Enter a three digit number: 123\n",
|
||||||
|
"Enter a three digit number: 123\n",
|
||||||
|
"Enter a three digit number: 345\n",
|
||||||
|
"Enter a three digit number: 23\n",
|
||||||
|
"Enter a three digit number: 100\n",
|
||||||
|
"Enter a three digit number: 675\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"You win\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"while finished == False:\n",
|
||||||
|
" guess = input(\"Enter a three digit number:\")\n",
|
||||||
|
" # covert to integer\n",
|
||||||
|
" guess = int(guess)675\n",
|
||||||
|
" if guess == number:\n",
|
||||||
|
" print(\"You win\")\n",
|
||||||
|
" finished = True"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 8,
|
||||||
|
"id": "232eb403-b705-447e-8d16-0909c4e63e6a",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"707\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 9,
|
||||||
|
"id": "12d5c294-7fc8-47ad-a3bd-45d10bbed198",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"['7', '0', '7']\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"number_parts = [s for s in str(number)]\n",
|
||||||
|
"print(number_parts)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 24,
|
||||||
|
"id": "a4d0cfc2-34a1-43e8-8c91-5fe2918a4e9e",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdin",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Enter a three digit number: 123\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"1 2 3 \n",
|
||||||
|
"P \n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdin",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Enter a three digit number: 456\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"4 5 6 \n",
|
||||||
|
" \n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdin",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Enter a three digit number: 789\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"7 8 9 \n",
|
||||||
|
"P P \n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdin",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Enter a three digit number: 817\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"You win!\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 22,
|
||||||
|
"id": "c43c7dc8-93f2-4f61-821f-1f8f0c2aba39",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"9\r"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"from time import sleep\n",
|
||||||
|
"for i in range(10):\n",
|
||||||
|
" print(i, end=\"\\r\")\n",
|
||||||
|
" sleep(1)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 22,
|
||||||
|
"id": "f647c557-d247-48b9-8c31-5623dea46336",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"IPython will make a temporary file named: /tmp/ipython_edit_m0vz1ei2/ipython_edit_oww2f6iw.py\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"%edit"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "1abd05b8-dfca-4fcc-8bb0-57dd77329086",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"ls\n"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@@ -25,7 +521,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.9.7"
|
"version": "3.10.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
33
notebooks/picofumi.py
Normal file
33
notebooks/picofumi.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import random
|
||||||
|
random.seed()
|
||||||
|
|
||||||
|
number = random.randrange(100, 999)
|
||||||
|
number = list(str(number))
|
||||||
|
guesses = 0
|
||||||
|
while True:
|
||||||
|
|
||||||
|
if guesses == 5:
|
||||||
|
print("You loose!")
|
||||||
|
for value in number:
|
||||||
|
print(value, end=" ")
|
||||||
|
break
|
||||||
|
hint = [" ", " ", " "]
|
||||||
|
guess = input("Enter a three digit number:")
|
||||||
|
while len(guess) != 3:
|
||||||
|
guess = input("Enter a three digit number:")
|
||||||
|
|
||||||
|
guess = list(guess)
|
||||||
|
if guess == number:
|
||||||
|
print("You win!")
|
||||||
|
break
|
||||||
|
for index, value in enumerate(guess):
|
||||||
|
print(value, end=" ")
|
||||||
|
if value in number:
|
||||||
|
hint[index] = "P"
|
||||||
|
print("")
|
||||||
|
for index, value in enumerate(guess):
|
||||||
|
if number[index] == value:
|
||||||
|
hint[index] = "F"
|
||||||
|
print(hint[index], end=" ")
|
||||||
|
guesses += 1
|
||||||
|
print("\n")
|
5
src/main.py
Normal file
5
src/main.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
def main():
|
||||||
|
print("Hello World")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Reference in New Issue
Block a user