慕侠0006521
2021-09-19 15:15
s = 'asdfghjklqwertyuiopzxcvbnm'
num = 1
for h in s:
num = num +1
if num >20:
break
print(h)
s = 'asdfghjklqwertyuiopzxcvbnm'
num = 1
for h in s:
num = num +1
if num >20:
break
print(h)
## 若要输出前二十位,注意print位置在if一级
s = 'asdfghjklqwertyuiopzxcvbnm'
num = 1
for h in s:
num = num +1
if num >20:
break
print(h)
输出print(h)要在循环里面。
Python3 入门教程(新版)
154175 学习 · 1075 问题
相似问题