Base Number Converter Function

GitHub

Traduções


About

A functions group inside in one function, to convert decimal numbers to others numbers bases, being then: binary, octagonal and hexadecimal.

How to Use

After of import the function with command:

from program impoprt Converter

You can assing a function to a variable, by passing the values, first value is the decimal number to convert and the other value is the base to convert number. See the examples bellow:

x = Convert(20,"Bin") # return 10100 as type int
x = Convert(30,"Oct") # return 36 as type int
x = Convert(15,"Hex") # return "F" as type sting

In value of the conversion base, you can by passing the value in number format, as:

x = Convert(20,2) # return 10100 as type int
x = Convert(30,8) # return 36 as type int
x = Convert(15,16) # return "F" as type sting

Flowcharts

This is the flowcharts that i used to create the program, sorry, the flowcharts is on portuguese

Flowchart of function Convert()

Flowchart of function of the convert to binary

Flowchart of function of the convert to octagonal

Flowchart of function of the convert to hexadecimal