Skip to main content
removed solution code
Source Link
curiouskiwi
  • 18.7k
  • 2
  • 18
  • 43

enter image description hereOn On cs50 IDE, for problem set 6 Caesar, it keeps saying my program is wrong and giving me a 37% but it compiles perfectly. I checked with check50 and everything it say's it doesn't do it does precisely. Below, is my code and it should receive near a perfect score.

from cs50 import get_string
from sys import argv

def main():
if len(argv) != 2:
print("Usage: error")#check if enough arguements are passed
exit(1)

while True:
key = int(argv[1])#gets key as int and validates
if key > 0:
break

pretext = get_string("plaintext: ")
print("cipertext: ", end="");

for i in range(len(pretext)):#enciphers length of string

if str.isupper(pretext[i]):#uppercase letters
uppercase = ((ord(pretext[i]) - 65 + key)% 26)+65
print(chr(uppercase), end="")
elif str.islower(pretext[i]):#lowercase letters
lowercase = ((ord(pretext[i])- 97 + key)% 26)+ 97
print(chr(lowercase), end="")
else:
print("{}".format(pretext[i]), end="")

print()

if __name__=="__main__":
main()

[removed solution code]

enter image description hereOn cs50 IDE, for problem set 6 Caesar, it keeps saying my program is wrong and giving me a 37% but it compiles perfectly. I checked with check50 and everything it say's it doesn't do it does precisely. Below, is my code and it should receive near a perfect score.

from cs50 import get_string
from sys import argv

def main():
if len(argv) != 2:
print("Usage: error")#check if enough arguements are passed
exit(1)

while True:
key = int(argv[1])#gets key as int and validates
if key > 0:
break

pretext = get_string("plaintext: ")
print("cipertext: ", end="");

for i in range(len(pretext)):#enciphers length of string

if str.isupper(pretext[i]):#uppercase letters
uppercase = ((ord(pretext[i]) - 65 + key)% 26)+65
print(chr(uppercase), end="")
elif str.islower(pretext[i]):#lowercase letters
lowercase = ((ord(pretext[i])- 97 + key)% 26)+ 97
print(chr(lowercase), end="")
else:
print("{}".format(pretext[i]), end="")

print()

if __name__=="__main__":
main()

On cs50 IDE, for problem set 6 Caesar, it keeps saying my program is wrong and giving me a 37% but it compiles perfectly. I checked with check50 and everything it say's it doesn't do it does precisely. Below, is my code and it should receive near a perfect score.

[removed solution code]

edited tags
Link
Cliff B
  • 69.3k
  • 4
  • 33
  • 56
added 85 characters in body
Source Link
user24000
user24000

Onenter image description hereOn cs50 IDE, for problem set 6 Caesar, it keeps saying my program is wrong and giving me a 37% but it compiles perfectly. I checked with check50 and everything it say's it doesn't do it does precisely. Below, is my code and it should receive near a perfect score.

from cs50 import get_string
from sys import argv

def main():
if len(argv) != 2:
print("Usage: error")#check if enough arguements are passed
exit(1)

while True:
key = int(argv[1])#gets key as int and validates
if key > 0:
break

pretext = get_string("plaintext: ")
print("cipertext: ", end="");

for i in range(len(pretext)):#enciphers length of string

if str.isupper(pretext[i]):#uppercase letters
uppercase = ((ord(pretext[i]) - 65 + key)% 26)+65
print(chr(uppercase), end="")
elif str.islower(pretext[i]):#lowercase letters
lowercase = ((ord(pretext[i])- 97 + key)% 26)+ 97
print(chr(lowercase), end="")
else:
print("{}".format(pretext[i]), end="")

print()

if __name__=="__main__":
main()

On cs50 IDE, for problem set 6 Caesar, it keeps saying my program is wrong and giving me a 37% but it compiles perfectly. I checked with check50 and everything it say's it doesn't do it does precisely. Below, is my code and it should receive near a perfect score.

from cs50 import get_string
from sys import argv

def main():
if len(argv) != 2:
print("Usage: error")#check if enough arguements are passed
exit(1)

while True:
key = int(argv[1])#gets key as int and validates
if key > 0:
break

pretext = get_string("plaintext: ")
print("cipertext: ", end="");

for i in range(len(pretext)):#enciphers length of string

if str.isupper(pretext[i]):#uppercase letters
uppercase = ((ord(pretext[i]) - 65 + key)% 26)+65
print(chr(uppercase), end="")
elif str.islower(pretext[i]):#lowercase letters
lowercase = ((ord(pretext[i])- 97 + key)% 26)+ 97
print(chr(lowercase), end="")
else:
print("{}".format(pretext[i]), end="")

print()

if __name__=="__main__":
main()

enter image description hereOn cs50 IDE, for problem set 6 Caesar, it keeps saying my program is wrong and giving me a 37% but it compiles perfectly. I checked with check50 and everything it say's it doesn't do it does precisely. Below, is my code and it should receive near a perfect score.

from cs50 import get_string
from sys import argv

def main():
if len(argv) != 2:
print("Usage: error")#check if enough arguements are passed
exit(1)

while True:
key = int(argv[1])#gets key as int and validates
if key > 0:
break

pretext = get_string("plaintext: ")
print("cipertext: ", end="");

for i in range(len(pretext)):#enciphers length of string

if str.isupper(pretext[i]):#uppercase letters
uppercase = ((ord(pretext[i]) - 65 + key)% 26)+65
print(chr(uppercase), end="")
elif str.islower(pretext[i]):#lowercase letters
lowercase = ((ord(pretext[i])- 97 + key)% 26)+ 97
print(chr(lowercase), end="")
else:
print("{}".format(pretext[i]), end="")

print()

if __name__=="__main__":
main()
Source Link
user24000
user24000
Loading