- 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.
推薦閱讀
- Getting Started with Clickteam Fusion
- Zabbix Network Monitoring(Second Edition)
- 計算機圖形圖像處理:Photoshop CS3
- Apache Spark Deep Learning Cookbook
- 中國戰略性新興產業研究與發展·智能制造
- Apache Superset Quick Start Guide
- 分數階系統分析與控制研究
- 氣動系統裝調與PLC控制
- Learning ServiceNow
- Web編程基礎
- 工業機器人入門實用教程
- Photoshop CS4數碼照片處理入門、進階與提高
- Eclipse RCP應用系統開發方法與實戰
- JSP通用范例開發金典
- 從機器學習到無人駕駛