- 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.
推薦閱讀
- Big Data Analytics with Hadoop 3
- 輕輕松松自動化測試
- Getting Started with Clickteam Fusion
- 基于LabWindows/CVI的虛擬儀器設計與應用
- Dreamweaver CS3網(wǎng)頁設計50例
- 返璞歸真:UNIX技術內(nèi)幕
- 工業(yè)機器人工程應用虛擬仿真教程:MotoSim EG-VRC
- Supervised Machine Learning with Python
- 大數(shù)據(jù)平臺異常檢測分析系統(tǒng)的若干關鍵技術研究
- 運動控制器與交流伺服系統(tǒng)的調(diào)試和應用
- Hands-On Reactive Programming with Reactor
- 軟件構件技術
- AI的25種可能
- Microsoft System Center Data Protection Manager Cookbook
- 數(shù)據(jù)結構與實訓