0

Here is my code:

import cs50 cipher=[] if len(cs50.sys.argv) != 2: print("You should provide cmd line arguments!") exit(1)

k= int(cs50.sys.argv[1]) print("Enter Plain Text:") p=cs50.get_string()

for c in p:

if c.isalpha():
    if c.isupper():
        print(ord("c"))
        y=(((ord("c")-65+k)%26)+65)
        cipher.append(chr(y))

    if c.islower():
        print(c)
        print(ord("c"))
        y=(((ord("c")-97+k)%26)+97)
        cipher.append(chr(y))

else:
    print(c)
    cipher.append(c)

print("".join(cipher))

1

But ord("c") is 99. Maybe you meant ord(c) instead?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .