Sorting by value and printing both, key and value properly. PYTHON
<p><strong>Question 1</strong>: How Can I add to dictionary with asking user, I.E. Input ("Write Runners name"), Input ("Write elapsed time!")</p>

<p><strong>Question 2</strong>: 
I would like to make the output like this.
Underneath my Code .... Drafts :)</p>

<pre><code>import operator
</code></pre>

<p><strong>Dictionary</strong></p>

<pre><code>runners = {"John": 9, "Mike": 2, "Venera": 4}
</code></pre>

<p>Output:</p>

<pre><code>1st. "Entered runner name ", came at, "input time"
2nd. "Entered runner name ", came at, "input time"
3rd. "Entered runner name ", came at, "input time"
</code></pre>

<p>Below it sorts from least to more</p>

<pre><code>s = sorted(runners.items(), key=operator.itemgetter(1))
print(s)
</code></pre>

<p>Example will give you full understanding my problem. So, example code is this, I just want to make it easier.</p>

<pre><code>names =[]
array_times = []
</code></pre>

<p>Looping it questions, to not write bunch of inputs 
for i in range(3):</p>

<pre><code> name=input("Please write the name of Runner!")
    #Appending name to the array name above!
    names.append(name)
    time_elapsed = float(input("Please write the time you spend!"))
    #Appending it to the array above!
    array_times.append(time_elapsed)
# Just to make it easier to understand, assigning the values in arrays above to variables. 
runner1= names[0]
runner2=names[1]
runner3=names[2]
time1=array_times[0]
time2=array_times[1]
time3=array_times[2]
</code></pre>

<p>Writing if-else statement to check which one is which place. </p>

<pre><code>if time1&lt;time2 and time1&lt;time3 and time2&lt;time3:#First winner, second in second, third is last.
    print (runner1,  "wins! His time is", time1, runner2, "is second place. His time is", time2, "and ", runner3, "is third place. his time is ", time3)
elif time2&lt;time1 and time2&lt;time3 and time1&lt;time3:#Second winner, first in second place, third is last.
    print (runner2,  "wins! His time is", time2, runner1, "is second place. His time is", time1, "and ", runner3, "is third place. his time is ", time3)
elif time3&lt;time1 and time3&lt;time2 and time1&lt;time2:#Third winner, First is second, second is last.
    print (runner3,  "wins! His time is", time3, runner1, "is second place. His timae is", time1, "and ", runner2, "is third place. his time is ", time2)
elif time3&lt;time1 and time3&lt;time2 and time2&lt;time1:#Third winner, second is second, first is last.
     print (runner3,  "wins! His time is", time3, runner2, "is second place. His time is", time2, "and ", runner1, "is third place. his time is ", time1)
elif time2&lt;time1 and time2&lt;time3 and time3&lt;time1:#Third winner, second is second, first is last.
     print (runner2,  "wins! His time is", time2, runner3, "is second place. His time is", time
</code></pre>

<p>as mentioned in the python <a href="https://docs.python.org/3/tutorial/datastructures.html#dictionaries" rel="nofollow">doc</a></p>

<blockquote>
  <p>It is best to think of a dictionary as an unordered set of key: value pairs, with the requirement that the keys are unique (within one dictionary)</p>
</blockquote>

<p>Use <a href="https://docs.python.org/3/library/collections.html#ordereddict-objects" rel="nofollow">OrderedDict</a></p>

<pre><code>from collections import OrderedDict

no_of_runners = int(input())

runners = dict()
for i in range(no_of_runners):
    name = input()
    time = float(input())
    runners[name] = time
sorted_runners = OrderedDict(sorted(runners.items(), key=lambda t: t[1]))

runners_list = [(i,j) for i,j in sorted_runners.items()]

print (runners_list[0][0],  "wins! His time is", runners_list[0][1], runners_list[1][0], "is in second place. His time is", runners_list[1][1], "and ", runners_list[2][0], "is in third place. his time is ", runners_list[2][1])
</code></pre>

python sorting dictionary