从零开始,系统学习Python编程
了解Python的历史、特点和应用场景
print("Hello, Python!")
学习Python的基本数据类型和变量声明
name = "Python"
age = 30
pi = 3.14159
is_awesome = True
print("姓名:", name)
print("年龄:", age)
print("π:", pi)
print("是否很棒:", is_awesome)
掌握条件语句和循环结构
age = 18
if age >= 18:
print("成年人")
else:
print("未成年人")
print("\n打印数字 0 到 4:")
for i in range(5):
print(i)
学习如何定义和使用函数
def greet(name):
return f"Hello, {name}!"
message = greet("Python")
print(message)
# 测试不同参数
print(greet("世界"))
print(greet("Sandy"))