1. print()函数
(1) 输出字符串;
print('hello world!')
输出:hello world!
(2) 输出多个字符串,用逗号“,”隔开,遇到逗号会输出一个空格;
print('The quick brown fox', 'jumps over', 'the lazy dog')
输出:The quick brown fox jumps over the lazy dog
(3) 输出整数或计算结果;
print(100 + 200) or print(300)
输出:300
2. input()函数
name = input('please enter your name: ') print('hello,', name)
程序一运行,会首先打印出“please enter your name: ”
,用户可以根据提示输入名字,得到hello, xxx
的输出,如下图: