这里的基础函数,是使用频率最高的几种,仅作为快速入门的使用。更多函数请在第五章中查看。
2.1 print()
该函数意为在电脑屏幕上打印你想要的内容。
#第一种表达方式
print('Hello World!')
#第二种表达方式
print('Hello \nWorld!') #其中,\n的意思是换行
#第三种表达方式
print('''This is a text.
In this text, you don't need to press n anymore.
These three sentences mean there will be three line numbers on your computer.''')
#第四种表达方式(中文注入)
print('你好世界!')
2.2 input()
该函数意为可以让用户键入想要输入的内容,包括字符串、数字。
print(input('Please press anything you want:'))