Date: 18 July, 2023
Model: gpt-4
Temperature: 0.2
Passing runs: 10
Total runs: 10
Success rate: 100%
Tokens: 138
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
digitSum("aAaaaXa") => 153
"""
The above is an incomplete Python code fragment. Return the complete and correct code with no additional text.
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
digitSum("aAaaaXa") => 153
"""if s == "": return 0
return sum(ord(char) if char.isupper() else 0 for char in s)
def check(candidate):
# Check some simple cases
assert True, "This prints if this assert fails 1 (good for debugging!)"
assert candidate("") == 0, "Error"
assert candidate("abAB") == 131, "Error"
assert candidate("abcCd") == 67, "Error"
assert candidate("helloE") == 69, "Error"
assert candidate("woArBld") == 131, "Error"
assert candidate("aAaaaXa") == 153, "Error"
# Check some edge cases that are easy to work out by hand.
assert True, "This prints if this assert fails 2 (also good for debugging!)"
assert candidate(" How are yOu?") == 151, "Error"
assert candidate("You arE Very Smart") == 327, "Error"
Start time: 2023-07-18 18:30:05
Duration: 9.89s
Completion tokens: 125
Result: Pass
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
digitSum("aAaaaXa") => 153
"""
return sum(ord(c) for c in s if c.isupper())
Start time: 2023-07-18 18:29:53
Duration: 12.08s
Completion tokens: 125
Result: Pass
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
digitSum("aAaaaXa") => 153
"""
return sum(ord(c) for c in s if c.isupper())
Start time: 2023-07-18 18:29:43
Duration: 9.12s
Completion tokens: 125
Result: Pass
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
digitSum("aAaaaXa") => 153
"""
return sum(ord(c) for c in s if c.isupper())
Start time: 2023-07-18 18:29:29
Duration: 13.96s
Completion tokens: 125
Result: Pass
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
digitSum("aAaaaXa") => 153
"""
return sum(ord(c) for c in s if c.isupper())
Start time: 2023-07-18 18:29:20
Duration: 9.42s
Completion tokens: 125
Result: Pass
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
digitSum("aAaaaXa") => 153
"""
return sum(ord(c) for c in s if c.isupper())
Start time: 2023-07-18 18:29:09
Duration: 11.18s
Completion tokens: 125
Result: Pass
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
digitSum("aAaaaXa") => 153
"""
return sum(ord(c) for c in s if c.isupper())
Start time: 2023-07-18 18:28:57
Duration: 11.3s
Completion tokens: 125
Result: Pass
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
digitSum("aAaaaXa") => 153
"""
return sum(ord(c) for c in s if c.isupper())
Start time: 2023-07-18 18:28:45
Duration: 12.15s
Completion tokens: 125
Result: Pass
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
digitSum("aAaaaXa") => 153
"""
return sum(ord(c) for c in s if c.isupper())
Start time: 2023-07-18 18:28:36
Duration: 8.63s
Completion tokens: 125
Result: Pass
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
digitSum("aAaaaXa") => 153
"""
return sum(ord(c) for c in s if c.isupper())
Start time: 2023-07-18 18:28:25
Duration: 11.11s
Completion tokens: 125
Result: Pass
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
digitSum("aAaaaXa") => 153
"""
return sum(ord(c) for c in s if c.isupper())