- 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.
推薦閱讀
- 電氣自動化專業英語(第3版)
- ETL with Azure Cookbook
- 大數據專業英語
- STM32G4入門與電機控制實戰:基于X-CUBE-MCSDK的無刷直流電機與永磁同步電機控制實現
- 自動化控制工程設計
- 21天學通Visual Basic
- 統計策略搜索強化學習方法及應用
- CompTIA Linux+ Certification Guide
- Learning C for Arduino
- 人工智能:語言智能處理
- 計算機組成與操作系統
- Mastering Text Mining with R
- 重估:人工智能與賦能社會
- 深度學習之模型優化:核心算法與案例實踐
- AWS Administration:The Definitive Guide(Second Edition)