python - questions repeated 4x, float not callable, error on code -
i dont understand why code doesnt work , have repeated questions me 4 times. , float not callable. have tried doing quite awhile dont seem @ all. there easier way python3? learnt language 2 weeks ago. not whole new world me many of things not familiar with. such indentation
def get_taxi_info(): flag_down = float(input("what's flag-down fare: $")) within = float(input("what's rate per 400 meters within 9.8km? $")) beyond = float(input("what's rate per 350 meters beyond 9.8km? $")) distance = float(input("what's distance traveled (in meters)? ")) peak = input("is ride during peak period? [yes/no]") mid6 = input("is ride between midnight , 6am? [yes/no]") location = input("is there location surcharge? [yes/no]") surloca = float(input("what's amount of location surcharge?")) return (flag_down, within, beyond, distance, peak == 'yes', mid6 == 'yes', location == 'yes', surloca) def calculate_taxi_fare(): dist = get_taxi_info() if dist[3] > 9800: = (dist[3] - 9800) % 350 if == 0: = (extra//350) + 22 else: = (extra//350) + 23 return elif dist[3] <= 9800: = (dist[3] - 1000) % 400 if == 0: = (extra//400) else: = (extra//400) + 1 return def peakornot(): peak = get_taxi_info() if peak[4] == true , peak[5] == false: surcharge = 1.25 return surcharge elif peak[4] == false , peak[5] == true: surcharge = 1.50 return surcharge taxifare = calculate_taxi_fare() info = get_taxi_info() peak1 = peakornot() taxifare = calculate_taxi_fare() if info[6] == true: payable = ((info[0] + (info[1] * taxifare()) + (info[2] * taxifare())) * peak1[0]) + info[7] print ("the total fare $" + str(payable)) elif info[6] == false: payable = ((info[0] + (info[1] * taxifare()) + (info[2] * taxifare())) * peak1[0]) + info[7] print ("the total fare $" + str(payable))
the function calculate_taxi_fare
returns float
, on line taxifare
float
taxifare = calculate_taxi_fare()
therefore cannot taxifare()
because looks function call, can use example
info[1] * taxifare
Comments
Post a Comment