-4
    if EndTimeMinute < 10:
        EndTimeMinute = EndTimeMinute 

Need to add zero here

Currently the result is just coming out as a single digit. So the time is going out to 1:1. I need to make it so that my code bring out the time as 1:01.

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • 1
    `EndTimeMinute = EndTimeMinute`?! Pad it with a zero by string concatenation. – Andrew Li Sep 29 '17 at 23:31
  • `EndTimeMinute` holds a number but you want to change the textual representation (as a string). This information is not contained in the number. – Michael Butscher Sep 29 '17 at 23:33
  • 1
    Possible duplicate of [Display number with leading zeros](https://stackoverflow.com/questions/134934/display-number-with-leading-zeros) – Barmar Sep 29 '17 at 23:34
  • Just try it with this code: print "%02d" % (1,) and % is like printf or sprint. – Fady Saad Sep 29 '17 at 23:44

1 Answers1

0

You have to convert it into a string.

Pad it with

n = 7 # Example

if n < 10:
    result = '%02d' % n
else:
    result = str(n)
print result
Isaiah
  • 91
  • 6