Skip to content

vitalychasovskih/python-project-49

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Math Brain Games

Five CLI math brain games

Actions Status Maintainability

About

This is my first python project on Hexlet.

"Math Brain Games" is a set of five console games. Each game asks questions that need to be answered correctly. After three correct answers, the game is considered completed. Incorrect answers end the game and prompt you to play it again.

Games:

  • Brain Even: Determining an even number.
  • Brain Calc: Arithmetic expressions to be calculated.
  • Brain GCD: Determining the largest common divisor.
  • Brain Progression: Finding missing numbers in a sequence of numbers.
  • Brain Prime: Determining a prime number.

Example:

>> brain-progression

Welcome to the Brain Game!
May I have your name? Jon Snow # The user enters the answer
What number is missing in this progression?
Question: 14 .. 18 20 22 24 26 28
Your answer: 16 # The user enters the answer
Correct!
Question: 5 6 7 8 9 .. 11 12
Your answer: 10 # The user enters the answer
Correct!
Question: 12 15 18 21 .. 27 30 33
Your answer: 24 # The user enters the answer
Correct!
Congratulations, Jon Snow!

Built With

  • Python
  • Poetry
  • flake8

Installation

Prerequisites

Python

Before installing the package make sure you have Python version 3.10 or higher installed:

>> python --version
Python 3.10.0+

Poetry

The project uses the Poetry dependency manager. To install Poetry use its official instruction.

Package

To use the package, you need to clone the repository to your computer. This is done using the git clone command. Clone the project:

>> git clone https://github.com/vitalychasovskih/python-project-49

Then you have to build the package and install it:

>> cd python-project-49
>> make build
>> make package-install

Usage

Brain Even

A random number is shown to the user. And he needs to answer yes if the number is even, or no if it is odd.

>> brain-even

Answer "yes" if the number is even, otherwise answer "no".
Question: 98
Your answer: no
'no' is wrong answer ;(. Correct answer was 'yes'.
>> brain-even

Answer "yes" if the number is even, otherwise answer "no".
Question: 82
Your answer: yes
Correct!

Brain Calc

The user is shown a random mathematical expression, for example 25 + 17 which needs to be calculated and written down the correct answer.

>> brain-calc

What is the result of the expression?
Question: 3 + 15
Your answer: 315
'315' is wrong answer ;(. Correct answer was '18'.
>> brain-calc

What is the result of the expression?
Question: 5 * 15
Your answer: 75
Correct!

Brain GCD

The user is shown two random numbers, for example, 25 50. The user must calculate and enter the greatest common divisor of these numbers.

>> brain-gcd

Find the greatest common divisor of given numbers.
Question: 95 96
Your answer: 5
'5' is wrong answer ;(. Correct answer was '1'.
>> brain-gcd

Find the greatest common divisor of given numbers.
Question: 56 91
Your answer: 7
Correct!

Brain Progression

A series of numbers that form an arithmetic progression is shown to the player, replacing any of the numbers with two dots. The player must enter this number.

>> brain-progression

What number is missing in the progression?
Question: 13 22 31 40 49 58 67 76 85 .. 103
Your answer: 100
'100' is wrong answer ;(. Correct answer was '94'.
>> brain-progression

What number is missing in the progression?
Question: 11 16 .. 26 31 36 41 46
Your answer: 21
Correct!

Brain Prime

A random number is shown to the user. He needs to answer yes if the number is prime, or no if it is not.

>> brain-prime

Answer "yes" if given number is prime. Otherwise answer "no".
Question: 66
Your answer: yes
'yes' is wrong answer ;(. Correct answer was 'no'.
>> brain-prime

Answer "yes" if given number is prime. Otherwise answer "no".
Question: 22
Your answer: no
Correct!


Additionally

Dependencies

  • python = "^3.10"

Dev Dependencies

  • flake8 = "^7.0.0"

This is the first training project of the "Python Developer" course on Hexlet.io

GitHub @Vitaly Сhasovskih

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published