# conditional statements. # Examples of a simple if statement. # score passing? score = int(input("Your exam score: ")) if score >= 70: print("Congratulations! You passed the exam.") print("Keep up the good work.") # version 2: improper identation. score = int(input("Your exam score: ")) if score >= 70: print("Congratulations! You passed the exam.") print("Keep up the good work.") # membership discount price = float(input("price: ")) is_member = True # Assume to be a member. if is_member: price *= 0.9 # Apply 10% discount print(f"Final member price: ${price:.2f}") # Add free chocolate for coupon. shopping_cart = ["milk", "bread"] is_member = True if is_member: shopping_cart.append("chocolate") print(f"Your shopping cart: {shopping_cart}") # set is_hot_day. v1 temperature = float(input("current temperature: ")) is_hot_day = False if temperature > 85: is_hot_day = True print(f"Is it a hot day ({temperature} C)? {is_hot_day}") # set is_hot_day. v2 temperature = float(input("current temperature: ")) if temperature > 85: is_hot_day = True else: is_hot_day = False print(f"Is it a hot day ({temperature} C)? {is_hot_day}") # set is_hot_day. v3 temperature = float(input("current temperature: ")) is_hot_day = temperature > 85 print(f"Is it a hot day ({temperature} C)? {is_hot_day}")