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

Working with booleans

As you build your recipe scaler project, you need to track which ingredients you already have at home versus which ones you need to buy at the store. Booleans are perfect for storing this yes/no information. You've already created variables for some ingredients in your recipe, and now you'll add boolean variables to track their availability.

Bu egzersiz

Introduction to Python for Developers

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

Egzersiz talimatları

  • Create a boolean variable called has_pasta and set it to True to indicate you already have pasta at home.
  • Create a boolean variable called has_garlic and set it to False to indicate you need to buy garlic.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Track if you have pasta at home
has_pasta = ____

# Track if you have garlic
has_garlic = ____

print(has_pasta)
print(has_garlic)
Kodu Düzenle ve Çalıştır