title: Conversion of types of objects
body: <p>How to write a function on python that accepts two objects in input and gives on output minimal type which both of objects can be presented?</p>
  <p>Example: we have two objects: <code>1</code> and <code>5.25</code>.We can't convert them both to <code>int</code> because then we will miss information about <code>5.25</code> that will be converted to <code>5</code>. We can convert them both to <code>float</code>: <code>1.0</code> and <code>5.25</code> and that is correct answer. Sure we can say that we can convert them both to <code>str</code>: <code>&quot;1&quot;</code>, <code>&quot;5.25&quot;</code>, but in our interpretation we suppose that <code>int &lt; float &lt; tuple &lt; list &lt; str</code> (of course we can't compare types of objects, but we suppose that to get an answer) and then <code>float</code> is the minimum available type that both objects can be converted to.</p>
  <p>I tried something like:</p>
  <pre><code>def type_convertion(first, second):
      data_types = [int, float, tuple, list, str]
      times = {}
      for _type in data_types:
          times[_type] = 0
          try:
              if isinstance(_type(first), _type):
                  times[_type] += 1
          except TypeError:
              del times[_type]
              continue
          try:
              if isinstance(_type(second), _type):
                  times[_type] += 1
          except TypeError:
              del times[_type]
              continue
          return times.keys()
  </code></pre>
  <p>But when I compare <code>int</code> and <code>float</code> the answer is <code>int</code> but should be <code>float</code> and I don't know how to fix it.</p>