pyhotn3入门基础-1

xiaoxiao2021-02-28  76

1. 输入输出:

输出

print('hello world') hello world

print('a','d') //遇到逗号会输出空格,输出 a d

>>> print(300) 300 >>> print(100 + 200) 300 >>> print('100 + 200 =', 100 + 200) 100 + 200 = 300

输入

name = input() //输入之后,name即为输入的内容

在文件中写简单的输入输出代码xxx.py

name = input('please input your name: ') print("hello ",name)

2. 退出编辑器:

exit() 3. 编辑器保存python文件:后缀py 选择UTF-8 无BOM 格式

4. 代码缩进 : 冒号就是代码块开始的地方

# print absolute value of an integer: a = 100 if a >= 0: print(a) else: print(-a) 5. 注释  # 

转载请注明原文地址: https://www.6miu.com/read-82880.html

最新回复(0)