BaşlayınÜcretsiz Başlayın

Calculating with variables

Now that you have assigned your run times and distances to variables, you want to process these times to calculate your average speed over the two runs.

You can calculate the speed using:

$$\text{speed} = \frac{\text{distance}}{\text{time}}$$

The variables monday_distance, wednesday_distance, monday_time, and wednesday_time are all available in your environment.

Bu egzersiz

Introduction to Julia

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Calculate the total miles run by adding monday_distance and wednesday_distance and dividing their total by 1609.
  • Calculate the total number of hours spent running by adding monday_time and wednesday_time and dividing their total by 60.
  • Calculate the average run speed across the two runs in miles per hour.
  • Print the average run speed.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Calculate the total distance in miles
total_distance = ____/1609

# Calculate the total run time in hours
total_time = ____/60

# Calculate the average speed
average_speed = ____

# Print the average speed
____
Kodu Düzenle ve Çalıştır