<reponame>breakthatbass/cs50_exercises<gh_stars>0
# cs50 pset 6
from cs50 import get_string
import sys


def main():
    if len(sys.argv) != 2:
        print("Usage: ./caesar key") # Remind user to giv an argument

    # converts the word into int
    key = int(sys.argv[1])

    word = get_string("Plaintext: ")
    print("Cyphertext: ", end="")

    #loop through each char in str and add the k ints to it
    fix = 65 if word.isupper() else 97
    for i in range(len(word)):

        # convert strings to unicode numbers
        a = ord(word[i])
        # do the math out to get correct ints
        b = ((((a - fix) + key) % 26) + fix)
        # convert back to chars
        c = chr(b)
        print(c, end="")

    print()

if __name__ == "__main__":
    main()
# cs50 pset 6
from cs50 import get_string
import sys


def main():
    if len(sys.argv) != 2:
        print("Usage: ./caesar key") # Remind user to giv an argument

    # converts the word into int
    key = int(sys.argv[1])

    word = get_string("Plaintext: ")
    print("Cyphertext: ", end="")

    #loop through each char in str and add the k ints to it
    fix = 65 if word.isupper() else 97
    for i in range(len(word)):

        # convert strings to unicode numbers
        a = ord(word[i])
        # do the math out to get correct ints
        b = ((((a - fix) + key) % 26) + fix)
        # convert back to chars
        c = chr(b)
        print(c, end="")

    print()

if __name__ == "__main__":
    main()
# cs50 pset 6 # Remind user to giv an argument # converts the word into int #loop through each char in str and add the k ints to it # convert strings to unicode numbers # do the math out to get correct ints # convert back to chars