python3-003 条件和循环
所属分类 python
浏览量 595
score=70
if score >= 90:
print("A")
elif score >= 60:
print("B")
else:
print("C")
def getLevel(score):
if score >= 90: return "A"
elif score >= 60: return "B"
else: return "C"
sum = 0
i = 0
while i <= 10:
sum = sum + i
i = i + 1
sum = 0
i = 0
while i <= 3:
sum = sum + i
i = i + 1
else:
print(f"done,i={i}")
pets = ["cat","dog","tiger"]
for i in pets:
print(i)
for i in range(3):
print(i,end=" ")
for i in range(1,5):
print(i,end=" ")
for i in range(1,10,3):
print(i,end=" ")
pets = ["cat","dog","tiger"]
for i in range(len(pets)):
print(i,pets[i])
list(range(3))
pass 不做任何事情,一般用做占位语句
上一篇
下一篇
网络报文分析利器eBPF简介
python3-001 基础语法
python3-002 基本数据类型
python3-004 迭代器和生成器
python3-005 函数
python3 str 内置函数调用错误