What do you think is wrong with my code ? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

What do you think is wrong with my code ?

sauerkraut abcdefghijklmnopqrstuvwxyz stuvwxyzabcdefghijklmnopqr abcdefghijklmnopqrstuvwxyz uvwxyzabcdefghijklmnopqrst efghijklmnopqrstuvwxyzabcd klmnopqrstuvwxyzabcdefghij rstuvwxyzabcdefghijklmnopq abcdefghijklmnopqrstuvwxyz tuvwxyzabcdefghijklmnopqrs message = input("Enter a codeword :") string = "abcdefghijklmnopqrstuvwxyz" size=len(string) message=' '.join(sorted(set(message), key= message.index)) print(string) for first in message: for i in range(len(string)): if first==string[i]: print(string[i:size]+string[0:i-size]) output for my code attempt : abcdefghijklmnopqrstuvwxyz stuvwxyzabcdefghijklmnopqr abcdefghijklmnopqrstuvwxyz uvwxyzabcdefghijklmnopqrst efghijklmnopqrstuvwxyzabcd rstuvwxyzabcdefghijklmnopq klmnopqrstuvwxyzabcdefghij tuvwxyzabcdefghijklmnopqrs

20th Feb 2021, 12:24 PM
Redo
9 Antworten
+ 3
Redo If this is not a challenge, Can you describe what output do you want?
20th Feb 2021, 12:57 PM
noteve
noteve - avatar
+ 2
I found this thread also mention that word "sauerkraut" (I don't even know what it means). But I'm guessing you two got this from the same source. https://www.sololearn.com/Discuss/2701950/?ref=app
20th Feb 2021, 1:23 PM
Ipang
+ 1
First, if that is a challenge, remove the text inside the input. Second, please provide more details to that challenge. Thanks.
20th Feb 2021, 12:46 PM
noteve
noteve - avatar
+ 1
Redo Yeah I get it now. But why is it printing (in the left side vertically) "asauekrat" instead of "sauerkraut" ?
20th Feb 2021, 1:06 PM
noteve
noteve - avatar
+ 1
I think that's just a bad example and your result was the intended ones. Sauerkraut, if you remove the similar char, will become sauerkt, not sauekrat, unless you use tons of assumption (is a the exception? why is the first r the one that got removed?
22nd Feb 2021, 12:15 PM
Satrio Bayu Pradhipta
Satrio Bayu Pradhipta - avatar
0
Eve Why you think this is a challenge above there's is the main output of the program , when i try to make a program my output is different so I'm asking what's is wrong , why o why? Not challenge bec I'm a beginner
20th Feb 2021, 12:54 PM
Redo
0
Eve this abcdefghijklmnopqrstuvwxyz stuvwxyzabcdefghijklmnopqr abcdefghijklmnopqrstuvwxyz uvwxyzabcdefghijklmnopqrst efghijklmnopqrstuvwxyzabcd klmnopqrstuvwxyzabcdefghij rstuvwxyzabcdefghijklmnopq abcdefghijklmnopqrstuvwxyz tuvwxyzabcdefghijklmnopqrs
20th Feb 2021, 1:00 PM
Redo
0
Eve Write a program and algorithm that accepts a codeword and displays the substitution lists for the codeword. For example, given the codeword “sauerkraut”, the program should display abcdefghijklmnopqrstuvwxyz stuvwxyzabcdefghijklmnopqr abcdefghijklmnopqrstuvwxyz uvwxyzabcdefghijklmnopqrst efghijklmnopqrstuvwxyzabcd klmnopqrstuvwxyzabcdefghij rstuvwxyzabcdefghijklmnopq abcdefghijklmnopqrstuvwxyz tuvwxyzabcdefghijklmnopqrs
20th Feb 2021, 1:02 PM
Redo
0
You know no given instructions by our teacher but i guess it's just like a cipher code , or substitution list the thing is that part is i don't know galit kasi yung teacher namin kaya walang explaination
20th Feb 2021, 1:13 PM
Redo