Compare commits

...

5 Commits

Author SHA1 Message Date
744d3e8a99 Basic working program 2021-12-08 20:54:31 +13:00
23fe675c08 File typo 2021-11-08 21:22:39 +13:00
d63f25b4f7 Add watch 2021-11-08 21:22:06 +13:00
d3d782b419 Add setup instructions 2021-11-08 21:21:09 +13:00
c0e4f76170 Add main.py 2021-11-08 21:20:51 +13:00
5 changed files with 310 additions and 4 deletions

2
.gitignore vendored
View File

@@ -1,2 +1,2 @@
.ipynb_checkpoints .ipynb_checkpoints
Pifile.lock Pipfile.lock

View File

@@ -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"

View File

@@ -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```

View File

@@ -7,6 +7,264 @@
"source": [ "source": [
"# Pico Fumi" "# Pico Fumi"
] ]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "0046af84-de64-4023-bdf5-335177caf22a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Pico Fumi\n"
]
}
],
"source": [
"print(\"Pico Fumi\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "3adeee26-8a18-4bad-946b-3d06920ef82f",
"metadata": {},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
"Enter a three digit number 333\n"
]
}
],
"source": [
"guess = input(\"Enter a three digit number:\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "7e1a2228-3316-4652-9051-70c355de94bb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"333\n"
]
}
],
"source": [
"print(number)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "f4412eef-6b79-4329-b8e7-85f916d3dfbf",
"metadata": {},
"outputs": [],
"source": [
"import random \n",
"random.seed()"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "d613f588-cfd6-447d-a0f5-4444e051b5b2",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"670\n"
]
}
],
"source": [
"number = random.randrange(1000)\n",
"print(number)"
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "6194de2b-2dbe-4c49-bc00-e5bed3c35f1f",
"metadata": {},
"outputs": [],
"source": [
"finished = False"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "e6e0b1c2-7c4b-4538-8421-bfdd027b1857",
"metadata": {},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
"Enter a three digit number: 1234\n",
"Enter a three digit number: 333\n",
"Enter a three digit number: 670\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)\n",
" if guess == number:\n",
" print(\"You win\")\n",
" finished = True"
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "232eb403-b705-447e-8d16-0909c4e63e6a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"482\n"
]
}
],
"source": [
"number = random.randrange(1000)\n",
"print(number)"
]
},
{
"cell_type": "code",
"execution_count": 45,
"id": "12d5c294-7fc8-47ad-a3bd-45d10bbed198",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['4', '8', '2']\n"
]
}
],
"source": [
"number_parts = [s for s in str(number)]\n",
"print(number_parts)"
]
},
{
"cell_type": "code",
"execution_count": 79,
"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 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",
" P \n",
"\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
"Enter a three digit number: 531\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"You win!\n"
]
}
],
"source": [
"number = random.randrange(1000)\n",
"number_parts = [s for s in str(number)]\n",
"guesses = 0\n",
"while True:\n",
" \n",
" if guesses == 5:\n",
" print(\"You loose!\")\n",
" break\n",
" hint = [\" \", \" \", \" \"]\n",
" guess = input(\"Enter a three digit number:\")\n",
" while len(guess) != 3:\n",
" guess = input(\"Enter a three digit number:\")\n",
" \n",
" \n",
" guess = [s for s in guess]\n",
" if guess == number_parts:\n",
" print(\"You win!\")\n",
" break\n",
" for index, value in enumerate(guess):\n",
" print(value, end=\" \")\n",
" if value in number_parts:\n",
" hint[index] = \"P\"\n",
" print(\"\")\n",
" for index, value in enumerate(guess):\n",
" if number_parts[index] == value:\n",
" hint[index] = \"F\"\n",
" print(hint[index], end=\" \")\n",
" guesses += 1\n",
" print(\"\\n\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f647c557-d247-48b9-8c31-5623dea46336",
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {
@@ -25,7 +283,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.7" "version": "3.9.9"
} }
}, },
"nbformat": 4, "nbformat": 4,

5
src/main.py Normal file
View File

@@ -0,0 +1,5 @@
def main():
print("Hello World")
if __name__ == "__main__":
main()