Skip to content
This repository has been archived by the owner on May 8, 2020. It is now read-only.

michali/Python-Katas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python-Katas

Practice with programming katas in Python

Bowling

Robert Martin's Bowling Kata. A scoring engine for 10-pin Bowling.

Binary Expression Tree

Develop code to allow a mathematical expression to be converted into a binary tree, which can then be evaluated to calculate the sum of the mathematical expression.

Write code that is unit tested that will:

  1. Produce the tree nodes necessary to represent the binary tree
  2. Use anonymous functions for the mathematical operations
  3. Build a binary tree by parsing the string representing the formula in part A
  4. Execute the operations and evaluate the tree by calling only the root tree node
  5. Not use if or switch statements or "new up" objects in objects that are used to define the binary tree. Object used for wiring may use if or switch statements or "new up" objects.

Your code must work with the following:

  • 2+4+3 evaluates to 9
  • 2+4*3 evaluates to 14
  • 2/4*6 evaluates to 3
  • 2+4*3+5 evaluates to 19
  • 2+4*3-5 evaluates to 9
  • 3+45+73*5-9 evaluates to 119
  • 3+45+735-9/62+7 evaluates to 132

About

Practice with programming katas in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages