Creating time stamps using .format()
<p>Basically in this assignment we have to create a time, based on values of ran(hour,min):. Below I will post the code I have and then the error message I receive. Is my code just really bad or there something I'm missing? What does it mean by "Can't convert 'int' object to str implicitly.</p>

<pre><code>def show_time(hour,min):
if(hour &gt; 12):
    hour = hour -12
if(min &lt; 10):
    min = "0"+min
print("{hour}:{min}".format(show_time()))
</code></pre>

<hr>

<pre><code>Traceback (most recent call last):
  File "zyLabsUnitTestRunner.py", line 10, in &lt;module&gt;
    passed = test_passed(test_passed_output_file)
  File "/home/runner/local/unit_test_student_code/zyLabsUnitTest.py", line 33, in test_passed
    ans = show_time(hour,min)
  File "/home/runner/local/unit_test_student_code/main.py", line 15, in show_time
    min = "0"+min
TypeError: Can't convert 'int' object to str implicitly
</code></pre>

<p>In the following line:</p>

<pre><code>if(min&lt;10):
    min = "0"+min
</code></pre>

<p>you are attempting to concatenate a string and an integer, which python cannot do. To convert a string to an int, use int(str), and to convert an int to a string, use str(int)</p>

python