我需要帮助将此代码转换为小写字母,然后子字符串删除空格然后找到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