← 2023 questions

2023 / GRAB / QUESTION 19

Airport pickup

Try the question in your own editor, then check your output below.

THE QUESTION

Tristan is on the way to Singapore for a photography competition. He wants to catch a grab to the airport at 8am from his house.

Show a list of available drivers and the time it will take for them to take Tristan to the airport in minutes.

Create a userinput function that allows the user to choose which driver they want and then output the time Tristan reaches the airport. After that, also print a statement showing the driver is on the way.

(Hint: the list should display the travel time in minutes. If he is to be picked up at 8am, then the time he reaches would have to be 8am + the travel time)

Question by Shriya. Source: Girls In Code SEA — Behind the Screens, 2023, slide 36.

PRACTICE CHECK

Try your answer.

New driver data. This checks arrival-time calculation; the full exercise also asks for driver selection and a confirmation.

Run your program in your own editor, then paste its output below. This checks the stated output or checkpoint; it does not assess your full program. Practice attempts do not affect competition scores.

Practice drivers: A takes 20 minutes; B takes 35 minutes. Choose B and depart at 08:00. Enter arrival as HH:MM.

Reveal worked answer

Arrival time

08:35

08:00 + 35 minutes = 08:35.