1.1 KiB
1.1 KiB
title | tags | aliases | ||||||
---|---|---|---|---|---|---|---|---|
variableNamingRules |
|
|
[!note] Naming Rules for Python Variables
Variable names must follow these rules:
- Must be a single word (no spaces)
- Can contain letters, numbers, and underscores
- Cannot start with a number
- Cannot include special characters
[!example] Valid vs ❌ Invalid Variable Names
Valid Variable Names Invalid Variable Names current_balance current-balance (no hyphens) currentBalance current balance (no spaces) account4 4account (starts with number) 42 42 (starts with number) TOTAL_SUM TOTAL_$UM (no special characters) hello 'hello' (no quotes allowed) [!info] Related Notes
variableNamingBestPractices
comments
pythonSyntaxOverview