Python 变量 Naming 测验
单选题 简单
题目
哪个的 following 是有效 Python 变量 name?
提示
变量 names 必须开始使用 letter or underscore, and cannot 包含 hyphens or 是 keywords.
解释
player_score 是有效: 它开始使用 letter, 包含仅 letters and underscore. 2nd_place 是无效因为 names cannot 开始使用 digit. 首先-name 是无效因为 hyphens 是不 允许 (Python 读取它 as subtraction). 类是 无效因为它 是 reserved Python keyword.
相关资源
相关课程
- Python 变量
学习如何变量工作 in Python.
相关速查表
- Python Cheatsheet
快速引用 for Python 变量 naming 规则.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。