我必须编辑我先前编写的代码以使其与输入配合使用,我将附加问题。我似乎无法使其正常工作。 它必须是某种输入,
string =" "
reversed_string = string[::-1]
result_string = " ".join(string)
for a in range (0 ,3):
result_string += chr(ord('a')+a)
for a in range(0 , 2)[::-1]:
result_string += chr(ord('a')+a)
print result_string
答案 0 :(得分:0)
string =“”
input( 'type a letter from a to z')
答案 1 :(得分:0)
这是我能回答的最短的
character = 97
char_list = []
con = True
a = 0
for interger in range(26):
char = chr(character)
char_list.append(char)
character = character+1
get_char = input("Enter a letter from a-z")
while con == True:
if get_char == char_list[a]:
b = char_list[:a+1]
char_list.reverse()
print(b+char_list[-a:])
con = False
else:
a = a+1