- 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
- 精通MATLAB神經網絡
- Hands-On Artificial Intelligence on Amazon Web Services
- Drupal 7 Multilingual Sites
- Blockchain Quick Start Guide
- Learning Social Media Analytics with R
- Learning Apache Cassandra(Second Edition)
- Zabbix Network Monitoring(Second Edition)
- Hadoop Real-World Solutions Cookbook(Second Edition)
- Splunk Operational Intelligence Cookbook
- Visual FoxPro數據庫基礎及應用
- 網絡安全技術及應用
- Windows Server 2008 R2活動目錄內幕
- 基于人工免疫原理的檢測系統模型及其應用
- 筆記本電腦維修之電路分析基礎