###### tags: `Python`,`TQC` # TQC+ 程式語言Python 802 字元對應 1. 題目說明: 請開啟PYD802.py檔案,依下列題意進行作答,顯示字串每個字元對應的ASCII碼及其總和,使輸出值符合題意要求。作答完成請另存新檔為PYA802.py再進行評分。 2. 設計說明: 請撰寫一程式,要求使用者輸入一字串,顯示該字串每個字元的對應ASCII碼及其總和。 3. 輸入輸出: 輸入說明 一個字串 輸出說明 依序輸出字串中每個字元對應的ASCII碼 每個字元ASCII碼的總和  ```python= s = input() ord_tot = 0 for i in range(len(s)): print("ASCII code for '{}' is {}".format(s[i],ord(s[i]))) ord_tot += ord(s[i]) print(ord_tot) ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up