Wang Fu Egypt

🔀 Decisions: if / else

Unit 1 · Think like a programmer · 9 min

if lets a program choose: if temp > 30: print("Hot") else: print("Nice"). A condition is either True or False. Common comparisons: >, <, == (equals), != (not equal).

Words in this lesson

  • condition — condition
  • True — True
  • False — False

Project: Write if/else for your weekend: if the weather is nice … else …, then add an elif.

Back to track · Learn

埃中王府
Wang Fu Egypt
加载中…