├── LICENSE
├── README.md
├── button.gif
├── guess_the_number.py
└── image.png
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Serhan Elmacıoğlu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
12 |
13 |

14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/button.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/serhanelmacioglu/Guess-the-Number_Coding-with-Python/b3d153b5876c996bd921ca53300339d032c84392/button.gif
--------------------------------------------------------------------------------
/guess_the_number.py:
--------------------------------------------------------------------------------
1 | import random
2 | number = random.randint(1, 10)
3 |
4 | player_name = input("Hello, what is your name? ")
5 | number_of_guesses = 0
6 | print('I\'m glad to meet you! {} \nLet\'s play a game with you, I will think a number between 1 and 10 then you will guess, alright? \nDon\'t forget! You have only 3 chances so guess:'.format(player_name))
7 |
8 | while number_of_guesses < 3:
9 | guess = int(input())
10 | number_of_guesses += 1
11 | if guess < number:
12 | print('Your estimate is too low, go up a little!')
13 | if guess > number:
14 | print('Your estimate is too high, go down a bit!')
15 | if guess == number:
16 | break
17 | if guess == number:
18 | print( 'Congratulations {}, you guessed the number in {} tries!'.format(player_name, number_of_guesses))
19 | else:
20 | print('Close but no cigar, you couldn\'t guess the number. \nWell, the number was {}.'.format(number))
21 |
--------------------------------------------------------------------------------
/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/serhanelmacioglu/Guess-the-Number_Coding-with-Python/b3d153b5876c996bd921ca53300339d032c84392/image.png
--------------------------------------------------------------------------------