下拉刷新
Repository Details
Shared bynavbar_avatar
repo_avatar
HelloGitHub Rating
0 ratings
一份以代码和注释方式讲解 Python 的免费教程
FreeMIT
Claim
Collect
Share
16.3k
Stars
Yes
Chinese
Python
Language
Yes
Active
15
Contributors
23
Issues
No
Organization
None
Latest
3k
Forks
MIT
License
More
一份以代码和注释方式讲解 Python 的免费教程。每个 Python 基础语法和知识点都采用可以运行的代码为例讲解,再配上适当的注释和参考资料,让你快速上手 Python。此项目不仅可以当做学习 Python 的资料,还可以留着做为速查表 ```python """WHILE statement @see: https://docs.python.org/3/tutorial/controlflow.html @see: https://docs.python.org/3/reference/compound_stmts.html#the-while-statement The while loop executes as long as the condition remains true. In Python, like in C, any non-zero integer value is true; zero is false. The condition may also be a string or list value, in fact any sequence; anything with a non-zero length is true, empty sequences are false. The test used in the example is a simple comparison. The standard comparison operators are written the same as in C: < (less than), > (greater than), == (equal to), <= (less than or equal to), >= (greater than or equal to) and != (not equal to). """ def test_while_statement(): """WHILE statement""" # Let's raise the number to certain power using while loop. number = 2 power = 5 result = 1 while power > 0: result *= number power -= 1 # 2^5 = 32 assert result == 32 ```

Comments

Rating:
No comments yet