- Python Programming with Raspberry Pi
- Sai Yamanoor Srihari Yamanoor
- 125字
- 2021-07-02 23:48:44
An exercise for the reader
Make use of the format() method to format a string with more than one variable.
Let's build a console/command-line application that takes inputs from the user and print it on the screen. Let's create a new file named input_test.py, (available along with this chapter's downloads) take some user inputs and print them on the screen:
name = input("What is your name? ")
address = input("What is your address? ")
age = input("How old are you? ")
print("My name is " + name)
print("I am " + age + " years old")
print("My address is " + address)
Execute the program and see what happens:

The input_test.py output
The preceding example is available for download along with this chapter as input_test.py.
推薦閱讀
- 機器學習實戰:基于Sophon平臺的機器學習理論與實踐
- 工業機器人技術及應用
- 空間機器人遙操作系統及控制
- 離散事件系統建模與仿真
- 自動檢測與轉換技術
- AWS Administration Cookbook
- 21天學通Java Web開發
- Machine Learning with the Elastic Stack
- Linux Shell編程從初學到精通
- 機器學習案例分析(基于Python語言)
- ARM嵌入式系統開發完全入門與主流實踐
- Flash 8中文版全程自學手冊
- SQL Server 2017 Machine Learning Services with R
- 機器學習公式詳解
- AWS Certified Advanced Networking:Specialty Exam Guide