[英]i there a way to rewrite the code?,i can not seem to get it right, i can not seem to get the input correctly
I have to edit the code i previously wrote to make it work with a input, I will attach the problem. 我必须编辑我先前编写的代码以使其与输入配合使用,我将附加问题。 I can not seem to get it to work.
我似乎无法使其正常工作。 it has to be some sort of input,
它必须是某种输入,
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
string =" " 字符串=“”
input( 'type a letter from a to z')
This is the shortest I could make the answer 这是我能回答的最短的时间
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.