MulaiMulai sekarang secara gratis

How many hurricanes come early?

In this chapter, you will work with a list of the hurricanes that made landfall in Florida from 1950 to 2017. There were 235 in total. Check out the variable florida_hurricane_dates, which has all of these dates.

Atlantic hurricane season officially begins on June 1. How many hurricanes since 1950 have made landfall in Florida before the official start of hurricane season?

Latihan ini adalah bagian dari kursus

Working with Dates and Times in Python

Lihat Kursus

Petunjuk latihan

  • Complete the for loop to iterate through florida_hurricane_dates.
  • Complete the if statement to increment the counter (early_hurricanes) if the hurricane made landfall before June.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Counter for how many before June 1
early_hurricanes = 0

# We loop over the dates
for hurricane in ____:
  # Check if the month is before June (month number 6)
  if ____.____ < ____:
    early_hurricanes = early_hurricanes + 1
    
print(early_hurricanes)
Edit dan Jalankan Kode