← Back to Basics

VIP Check

3 of 8

Exercise 4: VIP Check 🎫

πŸ”€ Conditionals πŸ“ Indentation

Your Task

Part A:

level = 15 has_pass = True

If level >= 10 AND has_pass, print "VIP Access!". Otherwise print "Access Denied"

Part B:

score = 85

Print rank based on score:

  • 90+: "A Rank"
  • 80-89: "B Rank"
  • 70-79: "C Rank"
  • Below 70: "Try Again"

Part C:

coins = 120 item_cost = 100 in_shop = True

If in_shop is True:

  • If coins >= item_cost: Print "Bought!" and subtract cost from coins
  • Else: Print "Not enough coins!" Else:
  • Print "Go to shop first!"

Example Output

VIP Access!
B Rank
Bought! 20 coins left

Try it yourself

Code: VIP Check

Loading Python runtime…
Python …
Loading...
bash
$ Click "Run" to execute your code...