Total money to be paid after traveling the given number of hours | Python3 implementation of the above approach ; calculating hours travelled
import math as ma NEW_LINE m , n , x , h = 50 , 5 , 67 , 2927 NEW_LINE z = int ( ma . ceil ( h / 60 ) ) NEW_LINE if ( z <= n ) : NEW_LINE INDENT print ( z * m ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( n * m + ( z - n ) * x ) NEW_LINE DEDENT