From b85f04959b7ab0207b166ebf49a63f56a78f5510 Mon Sep 17 00:00:00 2001 From: nathalie hubl Date: Fri, 26 Mar 2021 07:03:57 +0100 Subject: [PATCH 1/2] File with Code for Week 1 Project --- .DS_Store | Bin 0 -> 6148 bytes .gitignore.rtf | 28 ++++ your-project/.gitignore | 18 +++ .../Code Game \"Guess the number\".ipynb" | 147 ++++++++++++++++++ your-project/README.md | 20 +-- 5 files changed, 203 insertions(+), 10 deletions(-) create mode 100644 .DS_Store create mode 100644 .gitignore.rtf create mode 100644 your-project/.gitignore create mode 100644 "your-project/Code Game \"Guess the number\".ipynb" diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 random.randint(1,20) -> safe random nr in variable\n", + "\n", + "- explain player rules: player needs to guess a integer nr, from a random generated range between 1 - 20. limit 5 guesses.\n", + "text with rules + input option for player. \n", + "input needs to be integer -> write it for player and in input\n", + "\n", + "- new player input for guessing up to 5 times. -> while loop with limit of 5\n", + "(- if wrong --> too high or too low)\n", + "- After 5 wrong ones --> stop\n", + "- if guessed --> great, player won!!! --> Stop" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [], + "source": [ + "def guess_the_game():\n", + "\n", + " import random\n", + " x = random.randint(0, 20)\n", + " print(x)\n", + "\n", + " count = 0\n", + " guess_lim = 5\n", + " guesses_left = 5\n", + "\n", + " print(\"Hi, you will have 5 guesses. Please choose a number between 0 and 20\\n\")\n", + "\n", + "\n", + " while count < guess_lim:\n", + " try:\n", + " guess = int(input(\"Can you guess the Secret Number?! Please type your guess as an integer: \"))\n", + " \n", + " if guess > 20 or guess < 0 :\n", + " print(\"Sorry, the number you guesses is without the requested range\\n\")\n", + " count = count + 1 \n", + " guesses_left = guesses_left - 1\n", + " print(\"You have\", (guesses_left), \"left\\n\")\n", + " \n", + " elif guess == x:\n", + " print(\"Woohooo!!! You won!! That's the correct number\\n\")\n", + " break\n", + " \n", + " elif guess > x:\n", + " print(\"Sorry, the number you guessed to too high\\n\")\n", + " count = count + 1 \n", + " guesses_left = guesses_left - 1\n", + " print(\"You have\", (guesses_left), \"left\\n\")\n", + " \n", + " else:\n", + " print(\"Sorry, the number you guessed is too low\\n\")\n", + " count = count + 1 \n", + " guesses_left = guesses_left - 1\n", + " print(\"You have\", (guesses_left), \"left\\n\")\n", + " \n", + " except ValueError:\n", + " print(\"Please enter an integer\")\n", + "\n", + " else:\n", + " print(\"Sorry, you lost, you reached 5 guesses... Thank's for playing\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "guess_the_game()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.5" + }, + "varInspector": { + "cols": { + "lenName": 16, + "lenType": 16, + "lenVar": 40 + }, + "kernels_config": { + "python": { + "delete_cmd_postfix": "", + "delete_cmd_prefix": "del ", + "library": "var_list.py", + "varRefreshCmd": "print(var_dic_list())" + }, + "r": { + "delete_cmd_postfix": ") ", + "delete_cmd_prefix": "rm(", + "library": "var_list.r", + "varRefreshCmd": "cat(var_dic_list()) " + } + }, + "types_to_exclude": [ + "module", + "function", + "builtin_function_or_method", + "instance", + "_Feature" + ], + "window_display": false + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/your-project/README.md b/your-project/README.md index 2a8493d..855d675 100644 --- a/your-project/README.md +++ b/your-project/README.md @@ -1,9 +1,9 @@ Ironhack Logo -# Title of Your Project -*[Your Name]* +# Title of Your Project - Guess the Number Game +Nathalie Hubl -*[Your Cohort, Campus & Date]* +DAFT MAR2021, Remote/Berlin & 24.03.2021 ## Content - [Project Description](#project-description) @@ -13,22 +13,22 @@ - [Links](#links) ## Project Description -Write a short description of your project. Write 1-2 sentences about the game you chose to build and why. +In this game the player will have to guess a randomly selected number within the range 1 - 20. I think is a game that everyone can play, since it extremly simple to play. ## Rules -Briefly describe the rules of the game. +The player will have input 5 guesses in the game. ## Workflow -Outline the workflow you used in your project. What are the steps you went through? +First I took the time to think what is important in this project, which information do I need to give the player and how to code the program. After having an general idea, I started with a plan and a pseudocode, which I later converted into a code. Test runs to see if the game works. ## Organization -How did you organize your work? Did you use any tools like a kanban board? +I used Trello to outline the deadlines, using the template provided. -What does your repository look like? Explain your folder and file structure. +My code is in the folder "your-project" ## Links Include links to your repository, slides and kanban board. Feel free to include any other links associated with your project. [Repository](https://github.com/) -[Slides](https://slides.com/) -[Trello](https://trello.com/en) +[Slides](https://drive.google.com/file/d/1kW-C1MAjjMBjpsPM3S6orFS4446FlqD1/view?usp=sharing) +[Trello](https://trello.com/b/R1ERGr5x/plan-for-guess-the-number-game) From 933a98507654195a18cfda9ddae7c39eca80c10b Mon Sep 17 00:00:00 2001 From: nathalie hubl Date: Fri, 26 Mar 2021 11:48:38 +0100 Subject: [PATCH 2/2] new gitignore --- .gitignore.rtf | 28 ---- .gitignore.txt | 48 ++++++ your-project/.DS_Store | Bin 0 -> 6148 bytes your-project/.gitignore | 18 -- ...ame \"Guess the number\"-checkpoint.ipynb" | 154 ++++++++++++++++++ .../Code Game \"Guess the number\".ipynb" | 11 +- 6 files changed, 211 insertions(+), 48 deletions(-) delete mode 100644 .gitignore.rtf create mode 100644 .gitignore.txt create mode 100644 your-project/.DS_Store delete mode 100644 your-project/.gitignore create mode 100644 "your-project/.ipynb_checkpoints/Code Game \"Guess the number\"-checkpoint.ipynb" diff --git a/.gitignore.rtf b/.gitignore.rtf deleted file mode 100644 index a5d9824..0000000 --- a/.gitignore.rtf +++ /dev/null @@ -1,28 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600 -{\fonttbl\f0\fmodern\fcharset0 Courier;} -{\colortbl;\red255\green255\blue255;\red0\green0\blue0;} -{\*\expandedcolortbl;;\cssrgb\c0\c0\c0;} -\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 -\deftab720 -\pard\pardeftab720\sl280\partightenfactor0 - -\f0\fs24 \cf2 \expnd0\expndtw0\kerning0 -\outl0\strokewidth0 \strokec2 # Created by https://www.toptal.com/developers/gitignore/api/jupyternotebooks\ -# Edit at https://www.toptal.com/developers/gitignore?templates=jupyternotebooks\ -\ -### JupyterNotebooks ###\ -# gitignore template for Jupyter Notebooks\ -# website: http://jupyter.org/\ -\ -.ipynb_checkpoints\ -*/.ipynb_checkpoints/*\ -\ -# IPython\ -profile_default/\ -ipython_config.py\ -\ -# Remove previous ipynb_checkpoints\ -# git rm -r .ipynb_checkpoints/\ -\ -# End of https://www.toptal.com/developers/gitignore/api/jupyternotebooks\ -} \ No newline at end of file diff --git a/.gitignore.txt b/.gitignore.txt new file mode 100644 index 0000000..76b9408 --- /dev/null +++ b/.gitignore.txt @@ -0,0 +1,48 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/jupyternotebooks,macos +# Edit at https://www.toptal.com/developers/gitignore?templates=jupyternotebooks,macos + +### JupyterNotebooks ### +# gitignore template for Jupyter Notebooks +# website: http://jupyter.org/ + +.ipynb_checkpoints +*/.ipynb_checkpoints/* + +# IPython +profile_default/ +ipython_config.py + +# Remove previous ipynb_checkpoints +# git rm -r .ipynb_checkpoints/ + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# End of https://www.toptal.com/developers/gitignore/api/jupyternotebooks,macos \ No newline at end of file diff --git a/your-project/.DS_Store b/your-project/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 random.randint(1,20) -> safe random nr in variable\n", + "\n", + "- explain player rules: player needs to guess a integer nr, from a random generated range between 1 - 20. limit 5 guesses.\n", + "text with rules + input option for player. \n", + "input needs to be integer -> write it for player and in input\n", + "\n", + "- new player input for guessing up to 5 times. -> while loop with limit of 5\n", + "(- if wrong --> too high or too low)\n", + "- After 5 wrong ones --> stop\n", + "- if guessed --> great, player won!!! --> Stop" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "def guess_the_game():\n", + "\n", + " import random\n", + " x = random.randint(0, 20)\n", + " # print(x)\n", + "\n", + " count = 0\n", + " guess_lim = 5\n", + " guesses_left = 5\n", + "\n", + " print(\"Hi, you will have 5 guesses. Please choose a number between 0 and 20\\n\")\n", + "\n", + "\n", + " while count < guess_lim:\n", + " try:\n", + " guess = int(input(\"Can you guess the Secret Number?! Please type your guess as an integer: \"))\n", + " \n", + " if guess > 20 or guess < 0 :\n", + " print(\"Sorry, the number you guesses is without the requested range\\n\")\n", + " count = count + 1 \n", + " guesses_left = guesses_left - 1\n", + " print(\"You have\", (guesses_left), \"left\\n\")\n", + " \n", + " elif guess == x:\n", + " print(\"Woohooo!!! You won!! That's the correct number\\n\")\n", + " break\n", + " \n", + " elif guess > x:\n", + " print(\"Sorry, the number you guessed to too high\\n\")\n", + " count = count + 1 \n", + " guesses_left = guesses_left - 1\n", + " print(\"You have\", (guesses_left), \"left\\n\")\n", + " \n", + " else:\n", + " print(\"Sorry, the number you guessed is too low\\n\")\n", + " count = count + 1 \n", + " guesses_left = guesses_left - 1\n", + " print(\"You have\", (guesses_left), \"left\\n\")\n", + " \n", + " except ValueError:\n", + " print(\"Please enter an integer\")\n", + "\n", + " else:\n", + " print(\"Sorry, you lost, you reached 5 guesses... Thank's for playing\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "guess_the_game()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.5" + }, + "varInspector": { + "cols": { + "lenName": 16, + "lenType": 16, + "lenVar": 40 + }, + "kernels_config": { + "python": { + "delete_cmd_postfix": "", + "delete_cmd_prefix": "del ", + "library": "var_list.py", + "varRefreshCmd": "print(var_dic_list())" + }, + "r": { + "delete_cmd_postfix": ") ", + "delete_cmd_prefix": "rm(", + "library": "var_list.r", + "varRefreshCmd": "cat(var_dic_list()) " + } + }, + "types_to_exclude": [ + "module", + "function", + "builtin_function_or_method", + "instance", + "_Feature" + ], + "window_display": false + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git "a/your-project/Code Game \"Guess the number\".ipynb" "b/your-project/Code Game \"Guess the number\".ipynb" index d09d519..4e5ed1e 100644 --- "a/your-project/Code Game \"Guess the number\".ipynb" +++ "b/your-project/Code Game \"Guess the number\".ipynb" @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": 94, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -28,7 +28,7 @@ "\n", " import random\n", " x = random.randint(0, 20)\n", - " print(x)\n", + " # print(x)\n", "\n", " count = 0\n", " guess_lim = 5\n", @@ -86,6 +86,13 @@ "outputs": [], "source": [] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "code", "execution_count": null,