Giter VIP home page Giter VIP logo

unitsconverter's Introduction

Units Converter

The units converter is a python terminal program that takes values from the user and converts it to other units.

The live site is found here

the terminal

How to use

In a world of different parameters, languages and ways to measure a converter is a tool that will always come to good use when not knowing the differences by heart.

The program is very straightforward. You will as a user be presented with 5 options. Four of them equals conversion choices.

  • Celsius / Fahrenheit
  • Meters / feet
  • Kilos / pounds
  • Liters / gallons

walkthrough of the program

  • You are welcomed with a short message and an option menu.

menu

  • Choose a number between 1-5, if not correct input you will get an error message in the color red and retry new input.

validatemessage

  • After correct choice you will go to that part of the program.

degrees function

  • If you correct input is typed, you go to next phase and add value that will be calculated, else you will get a message about invalid input in red.

invalid input 2

  • When correct value is typed, 1 or 2, you can type a value and then get an answer message with an option to try new values.

correct input

If the answer is yes, you go back to program and choose what parameter you want to have converted. Else you will be sent to the main option menu.

The plot layout

plot layout Made with Microsoft Visio.

Calculations

Some methods used in the calculations were the following

  • int() - returns an integers number from a string
  • float() - returns a floating number from a number or a string
  • round() - return a floating number with a specific number of decimals, in my program 2 decimals.

Arithmetic operator used

  • Division /
  • Multiplication *
  • Subtraction -
  • Addition +

Colorama

To make program more user-friendly I imported colorama. The menu is in blue, wrong answers in red and the correct answer is yellow.

Testing

I have tested the program for each of the steps and tried to commit as often as I could. This has helped to minimize the amount of bugs and make sure the code is working properly.

Bugs

Some of the bugs that I have come across wasn't too hard to handle. Foremost it was string input that couldn't be handled since they weren't integers or floats. That was easily handled by using the int() or float()-function in the equations.

When adding colorama to the project I forgot to add it to the requirements.txt, thus creating getting an error message ModuleNotFoundError: No module named 'colorama in Heroku terminal.

One of the last bugs that I found was that after I ran a program e.g. degrees(), and came back to main-menu and choose the exit-option was that I didn't exit the program. Instead, I was stuck in a loop, with the menu. I then tried to do a separate function just to exit while not being in the while-loop of the choices. Didn't help, removed some while-loop, but still the same result. After some trial and errors, I went for the built-in function exit() that did the trick. I would count this as a bug that was not solved.

Validation

I validated my code via the pep8 online check, (http://pep8online.com/) without any error messages. This was possible by continuously reading the 'problems' message that was presented in the Gitpod IDE.

Deployment

GitHub Pages

The project was created on Github, by first forking the Code Institute template and since it's a python project, Github does not manage to have it deployed in its pages.

Heroku

Heroku was the platform the project was deployed to.

  1. Create an account.
  2. On the dashboard select New and Create new app which takes you to right place.
  3. Name the app, select region, click Create new app.
  4. Go to settings.
  5. Config Vars >> reveal vars >> add key:PORT, value: 8000 and click Add
  6. Add buildingpacks - add nodejs and python
  7. go to Deploy and choose method, github in this case, connect to it.
  8. Search and select/connect to your repository
  9. Choose Deploy Branch method, automatic or manual, I choose manual.
  10. Heroku will do its job connecting, and create a link to page.
  11. When message Your app was successfully deployed is received you can view the site.

Future add-ons

There are possibilities to add more units to the program.

One could also add a random() to generate examples of values within in each function.

Append made calculations to a Google spreadsheet.

unitsconverter's People

Contributors

awrelh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.