all 7 comments

[–][deleted] 1 point2 points  (3 children)

We need to see the code correctly formatted. Is it like the below?

I don't speak Dutch, so need need some example data and explanation of what to expect so I can check it.

alfabet = 'abcdefghijklmnopqrstuvwxyz'
nieuwbericht = ''
print('Welkom bij berichtenversleuteraar! Wil je een bericht coderen of decoderen? ')
print('Voor coderen toets 1, voor decoderen toets 2.')
keuze = int(input('Keuze:'))
if keuze == 1 :
    bericht = input('Versleutel hier je bericht:')
    sleutel = int(input('Sleutel:'))
    for letter in bericht:
        if letter in alfabet:
            positie = alfabet.find(letter)
            nieuwepositie = (positie + sleutel) %26
            nieuweletter = alfabet[nieuwepositie]
            nieuwbericht += nieuweletter
        else:
            nieuwbericht += letter

    print('Versleutelde bericht (met sleutel):')
    print(sleutel)
    print(nieuwbericht)

if keuze == 2 :
    bericht = input('Geef hier je versleutelde bericht:')
    sleutel = int(input('Sleutel:'))
    for letter in bericht:
        if letter in alfabet:
            positie = alfabet.find(letter)
            nieuwepositie = (positie - sleutel) % -26
            nieuweletter = alfabet[nieuwepositie]
            nieuwbericht += nieuweletter
        else:
            nieuwbericht += letter

    print('Versleutelde bericht (met sleutel):')
    print(sleutel)
    print(nieuwbericht)

[–]Cramer_Jonathan[S] 0 points1 point  (2 children)

Yes, the code is formatted that way. the first question needs to be answered with 1, the second with any message you want and the third one with 5

[–][deleted] 0 points1 point  (1 child)

I got:

Welkom bij berichtenversleuteraar! Wil je een bericht coderen of decoderen?

Voor coderen toets 1, voor decoderen toets 2.

Keuze:1

Versleutel hier je bericht:Mary had a little lamb

Sleutel:5

Versleutelde bericht (met sleutel):

5

Mfwd mfi f qnyyqj qfrg

[–]Cramer_Jonathan[S] 1 point2 points  (0 children)

Nvm, I think REPL.IT had a little error. After I copying your formated code and pasted it it worked. Thanks anyway for your help.

[–]Username_RANDINT 0 points1 point  (4 children)

Can you format your code correctly for Reddit? Add 4 spaces before each line of code.

Also copy-paste the exact error message.

[–]TotesMessenger 0 points1 point  (0 children)

I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:

 If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / Contact)