我需要幫助將此代碼轉換爲小寫字母,然後子字符串刪除空格然後找到ASCII值然後將它們加起來得到一筆總和,這就是我寫的:需要幫助將字符串轉換爲Unicode然後添加值
def main():
# Handshake
print("This program computes a total value for a user's full name")
# Prompt and read input
fullname = input("Please enter your full name: ")
# Convert user's full name to all lower case letters
fullname = fullname.lower()
# Split user's full name into substrings
fullname = fullname.split()
# Loop through each substring and compute
# total ASCII value of user's name
totalvalue = 0
for character in fullname:
fullname = ord(character) + totalvalue
#Display outputs
print("\nYour name is: ", fullname)
print("\nThe value of your name is: ", totalvalue)
main()
找不到問號! – manetsus