coding

Staircase

import sys

# Complete the staircase function below.
def staircase(n):
    for stairs in range(1, n + 1):
        print(' ' * (n - stairs) + '#' * stairs)

if __name__ == '__main__':
    n = int(input())

    staircase(n)

Time Conversion

Sample Input:

07:05:45PM

Sample Output:

19:05:45
#!/bin/python3
from datetime import *
import os
import sys

#
# Complete the timeConversion function below.
#
def timeConversion(s):
    #
    # Write your code here.
    #
    new_s = s[0:8] + ' ' + s[-2:]
    new_time = datetime.strptime(new_s, '%I:%M:%S %p').time()
    return(str(new_time))

if __name__ == '__main__':
    f = open(os.environ['OUTPUT_PATH'], 'w')

    s = input()

    result = timeConversion(s)

    f.write(result + '\n')

    f.close()

Dict

Last updated