I scored the web after an answer, found it, but still doesn't work. My caesar.py works fine, check50 shows me all happy faces except the last:
:( handles lack of argv[1]
expected exit code 1, not 0
Here is my main() function, where I put the check right at the beginning:
def main():
#check if argument was passed correctly
if len(sys.argv) != 2:
print("Usage: python caesar.py k")
return 1
k = int(sys.argv[1])
while True:
plainTxt = cs50.get_string("plaintext: ")
if plainTxt:
print("ciphertext: " , end = "")
for c in plainTxt:
if c.isalpha():
c = cipher(c, k)
#print character
print(c, end="")
#print new line
print()
#break the loop
break
What am I missing??
Thanks a lot! Best, Daniel