python3中的常用内置函数
-
input()函数:
在终端打印括号中的消息,等待用户输入信息,然后将输入值返回并存储在内存中
例如:
name = input("What's your name? ") #输入John Smith print("My name is " + name)
输出:
D:\Python37\python.exe "D:/pycharm project/myFirstPython.py" What's your name? John Smith My name is John Smith Process finished with exit code 0
e.g.1
Ask two questions: person’name and favourite color.
then,print a message like ‘Mosh like blue’Solution:
name = input("What's your name? ")