 
 <prompt> John ya koma gida na kishi na 200 miles zuwa gida na kishi na 70 mph. Ya bukaci a yi hankali da ya kara 10 miles zuwa gida. Bayan ya samu akwai ya koma gida na kishi na 240, amma ya kara 80 mph. Yaya za'a samu wani lokaci? Rubuta wani matsayin a python.

```python
distance_to_friend = 200
speed_to_friend = 70
detour = 10
distance_back_home = 240
speed_back_home = 80

time_to_friend = (distance_to_friend + detour) / speed_to_friend
time_back_home = distance_back_home / speed_back_home

total_time = time_to_friend + time_back_home
print("The total time for the trip is:", total_time, "hours")
``` <response>: def solution():
    """John ya koma gida na kishi na 200 miles. Ya koma a kan harkar 70 mph. Ya buɗe harkar da ta kara 10 miles zuwa harkar. Bayan ya samu akwai ya koma gida da harkar da ke 240 miles amma ya koma a kan harkar 80 mph. Yaya lokacin da harkar ya koma?"""
    miles_to_friend = 200
    miles_detour = 10
    miles_home = 240
    mph_to_friend = 70
    mph_home = 80
    time_to_friend = (miles_to_friend + miles_detour) / mph_to_friend
    time_home = miles_home / mph_home
    total_time = time_to_friend + time_home
    result = total_time
    return result 