Python基础学习-10
a = 1
b = 2
print(a == b)
print(a != b)
print(a < b)
print(a <= b)
print(a > b)
print(a >= b)
a = 33
b = 200
if b > a:
print("b 大于 a")
a = 33
b = 33
if b > a:
print("b 大于 a")
elif a == b:
print("a 等于 b")
else:
print("a 小于 b")
"""
and && 全部符合
or || 符合其中之一
"""
x = 5
if x > 6:
print("1")
if x > 3:
print("2")
else:
print("3")
else:
pass
i = 1
while i < 6:
print(i)
if i == 2:
i += 1
continue
if i == 3:
break
i += 1
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
for x in "banana":
print(x)
for x in range(6):
print(x)
adj = ["red", "big", "tasty"]
fruits = ["apple", "banana", "cherry"]
for x in adj:
for y in fruits:
print(x, y)
|