简体   繁体   English

我有办法重写代码吗?,我似乎无法正确执行,我似乎无法正确获取输入

[英]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 =" " 字符串=“”

add this to input from keyboard 将此添加到键盘输入

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.

相关问题 列表列表,我似乎无法正确缩进 - list of lists and i can't seem to get the indent right 有没有另一种方法可以做到这一点? 我已经尝试了 6 个版本的代码,运行时似乎无法得到结果 - is there another way to make this ? I have tried 6 versions of code, I can not seem to get a result when I run it 我似乎无法准确地得到它,我正在得到阶乘,但似乎无法找到一种方法来放入组合公式 - i can not seem to get it exactly, i am getting the factorials but cant seem to find a way to put in the combination formula 我似乎无法让我的 openpyxl 代码工作 - I can't seem to get my openpyxl code working 还有另一种方式可以写这个吗? 我只知道打印功能,但我似乎无法像示例那样得到它 - is there another way i can write this? i only know the print function,but i can not seem to get it like the example 我似乎无法在我的笔记本电脑上进行多处理 - I can't seem to get multiprocessing to work on my laptop 我似乎无法在 Spark 上使用 --py-files - I can't seem to get --py-files on Spark to work 我似乎无法摆脱这个程序在 python 上的循环 - I can't seem to get out of the loop on this program on python 我似乎无法使用此功能将列表添加在一起 - I can't seem to get this function to add the list together 我似乎无法让我的两只眼睛为 Turtle 工作 - I can't seem to get my 2 eyes working for Turtle
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM