1 #!/usr/bin/env python
 2 # -*- coding:utf-8 -*-
 3 #while循环里面True和False的作用,真和假
 4 """
 5 n1等于真(True),while循环开始,print字符串“1“,
 6 接着n1重新赋值为False(假),
 7 条件不再成立,所以跳出while循环,执行print字符串“end“
 8 """
 9 n1 = True
10 while n1:
11     print("1")
12     n1 = False
13 print("end")

 

相关文章:

  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2021-10-19
  • 2021-07-31
  • 2021-12-05
猜你喜欢
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
相关资源
相似解决方案