![TQC+ 程式語言Python 801 字串索引 TQC+ 程式語言Python 801 字串索引](https://i0.wp.com/jbprogramnotes.com/wp-content/uploads/2020/05/TQC-252B-2BPython.png?resize=1024%2C576&ssl=1)
TQC+ 程式語言Python 801 字串索引
題目說明:
請撰寫一程式,要求使用者輸入一字串,顯示該字串每個字元的索引。
範例輸入
Sandwich
範例輸出
Index of 'S': 0
Index of 'a': 1
Index of 'n': 2
Index of 'd': 3
Index of 'w': 4
Index of 'i': 5
Index of 'c': 6
Index of 'h': 7
程式碼:
Str = input()
for i in range(len(Str)):
print("Index of '%s': %d" %(Str[i], i))
TQC+ 程式語言Python 第8類:字串(String)的運作
如果覺得文章內容還不錯的話,麻煩請幫我點個讚!感謝
可以多點幾次喔~~
第一次點讚需使用 Google 或 Facebook 帳號註冊
![TQC+ 程式語言Python 802 字元對應 TQC+ 程式語言Python 802 字元對應](https://i0.wp.com/jbprogramnotes.com/wp-content/uploads/2020/05/TQC-252B-2BPython.png?resize=75%2C75&ssl=1)
![TQC+ 程式語言Python 710 詞典搜尋 TQC+ 程式語言Python 710 詞典搜尋](https://i0.wp.com/jbprogramnotes.com/wp-content/uploads/2020/05/TQC-252B-2BPython.png?resize=75%2C75&ssl=1)
一個評論
自動引用通知: