All pastes #781994 Raw Edit

Someone

public python v1 · immutable
·published 2007-11-19 02:31 UTC
rendered paste body
import mathdef calcPrice (zone,x):    if zone == 1:        price = x * 1    elif zone == 2:        price = x * 0.8    elif zone == 3:        price = x * 0.5    else:        print zone,' is not a valid zone. Please try again'        return 0    return pricedef insertCoin (price):    coin = int(raw_input('Please insert coin : '))    if coin == 0.10 or coin == 0.20 or coin == 0.50 or coin == 1 or coin == 2 :        if price > coin:            price = price - coin            print 'You have to insert more coins. New price is : ', price            return insertCoin (price)        else:            print 'Thank You'            return 0    else:        print coin ,'is not accepted'        print 'Accepted coins : 0.10 , 0.20 , 0.50 , 1 , 2'        return insertCoin(price)    print 'Please give ticket type :'print '1 for 1rst zone'print '2 for 2nd zone'print '3 for 3rd zone'zone = int(raw_input('Your choice : '))x = int(raw_input('Please give amount of tickets : '))price = calcPrice (zone,x)print 'The total cost is : ',priceinsertCoin (price)