Python学习之路3?while循环
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python学习之路3?while循环相关的知识,希望对你有一定的参考价值。
#_*_coding:utf-8_*_
#!/usr/bin/env python
count=0
# while count<10:
# print(‘==>‘,count)
# count+=1
# while True:
# print(‘------‘)
# for i in range(10):
# print(i)
# for i in ‘hello‘:
# print(i)
# msg=‘hello‘
# i=0
# while i<len(msg):
# print(msg[i])
# i+=1
# while 1:
# print(‘ok‘)
#循环的嵌套
# while True:
# name=input(‘username: ‘)
# if name == ‘quit‘:break
#
# print(name)
# while True:
# age=input(‘age: ‘)
#
# if age == ‘quit‘:break
#
# print(age)
# for i in range(5):
# print(‘=======第一层for‘)
# for j in range(2):
# print(‘--->‘)
# break
# print(‘->‘)
‘‘‘
‘第一层for‘
‘第二层for‘
‘第二层for‘
‘第一层for‘
‘第二层for‘
‘第二层for‘
‘‘‘
#标志位
# import sys
tag=True
while tag:
a=input("level1")
if a == ‘q‘: break
while tag:
b = input("level2")
if b == ‘q‘: break
while tag:
c=input(‘level3‘)
if c == ‘q‘: break
while tag:
d=input(‘level4‘)
if d == ‘q‘:break
# if d==‘exit‘:sys.exit()
if d == ‘exit‘:tag=False
print(‘====>‘)
以上是关于Python学习之路3?while循环的主要内容,如果未能解决你的问题,请参考以下文章