print("hello python");
print("--------------------------");
if True:
print("执行正确分支");
print("这是正确的");
else:
print("执行错误的分支");
print("这是错误的");
print("**************************");
fruits = ['苹果', '橘子', '雪梨', '西瓜', '芒果'];
isExistApple = False;
for fruit in fruits:
print('当前水果:', fruit);
if fruit == '西瓜':
print("哈哈!找到西瓜了");
else:
print("不是西瓜");
if fruit == '苹果':
isExistApple = True;
print("for循环结束啦");
for num in range(10, 20):
print("打印10到20之间的数字->", num);
print("range是内建函数吗?");
print("应该是吧");
print("水果筐里面有苹果吗?", isExistApple);
english = 50;
math = 50;
mySum = english + math;
print("我的总分是几多?", mySum);
很久前写过一点python,今天复习一下
最新推荐文章于 2025-11-26 15:40:52 发布
本文通过一系列Python代码示例,展示了如何使用print函数输出文本,条件判断的if-else语句,遍历列表的for循环,以及如何使用range函数生成数字序列。此外,还介绍了变量赋值和基本的算术运算。
8万+

被折叠的 条评论
为什么被折叠?



