Skip to content

StevenGreenup/fraction_calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fraction_calculator

Author: Steven Greenup

Date: 10.15.19

Problem:

Coding Challenge

Write a command line program in the language of your choice that will take operations on fractions as an input and produce a fractional result.

  • Legal operators shall be *, /, +, - (multiply, divide, add, subtract)

  • Operands and operators shall be separated by one or more spaces

  • Mixed numbers will be represented by whole_numerator/denominator. e.g. "3_1/4"

  • Improper fractions and whole numbers are also allowed as operands

MUST BE RAN WITH python3

Example Command Lines

./script.py --string_equation "3_1/4 * 5_1/2"
./script.py --string_equation "3_1/4 * -5_1/2"
./script.py --string_equation "3_1/4 - 5_1/2 * 11/4"
./script.py --string_equation "3_1/4 / -5 + 11/4"
./script.py --string_equation "3_1/4"
    
./script.py --operand1 "3_1/4" --operator "*" --operand2 "3_1/4"

RUN TESTS

cd path/to/fraction_calc
python3 -m unittest discover

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages