这个例子演示 Python 变量与 print() 的基本用法:先声明 name、age 两个变量分别存名字和年龄,再用 print() 把它们拼接输出。年龄是数字,直接跟字符串拼接会报 TypeError,需要先用 str() 转成字符串,这也是新手常遇到的坑。点击“运行”即可看到“我是小明,今年20岁”。适合 Python 入门教程练习变量声明、字符串拼接与 print 输出。
Política de privacidad Mapa del sitio Comentarios © 2024-2026 www.online-compiler.com All rights reserved.
Selección de idioma 中文 · English · 한국어 · Italiano · Русский · 日本語 · Español · 繁體中文