运行代码时,批处理规范化层引发错误。
word = input("Enter word:").strip() # strip() is used to remove any trailing or leading white spaces
print(word)
letterNum = int(len(word)) # Determines amount of letters in word
print(letterNum)
# 1st way (Using the internet that we created above)
lastLetter = word[letterNum - 1] # Supposed to figure out the last letter in a word
print(lastLetter)
# 2nd way (As the above answers suggest, -ve index, -1 for last, -2 for 2nd last, this is best, but this basically for Python, other language like C/C++ etc. use 1st way)
print(word[-1])
# 3rd way (Not good, but it is good for those who are learning Python,Reversing the string and printing 1st character)
print(word[::-1][0])
ValueError:尝试共享变量bn / gamma,但指定形状(256,)和找到形状(6400,)。