セクション 1. 章 3
single
Challenge: Simple Function Creation
メニューを表示するにはスワイプしてください
タスク
スワイプしてコーディングを開始
You are building a ride-sharing app. Each ride has a distance in kilometers, and you want to calculate the total cost based on a base fare and a per-kilometer rate.
- Declare the function
calculateTripCostthat returns adouble. - Add a parameter to the function with type
doublenameddistance. - Calculate the total cost by multiplying
distancebyperKmRateand adding thebaseFare. - Return the total cost from the function.
Do not modify the values of baseFare and perKmRate inside the calculateTripCost function.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 1. 章 3
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください