- Training Data Size: 1% of dataset
- Syntax Accuracy: 62.50%
- Execution Accuracy: 62.50%
- Functional Accuracy: 62.50%
def add(a,b):
return a+b
t(add(10,2))Test Input: print(add(5,7))
Expected Output: 12
Actual Output: 12
Success: True
Output Matches: False
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)Test Input: print(factorial(5))
Expected Output: 120
Actual Output: Runtime Error: name 'factorial' is not defined
Success: False
Output Matches: False
def is_prime(n):
"""Check if n is prime"""
for i in range(2, int(math.sqrt(n))+1):
if n % i == 0:
return False
return TrueTest Input: print(is_prime(17))
Expected Output: True
Actual Output: Runtime Error: name 'math' is not defined
Success: False
Output Matches: False
def reverse_string(s):
return s[::-1]Test Input: print(reverse_string("hello"))
Expected Output: olleh
Actual Output: olleh
Success: True
Output Matches: False
def find_max(list):
"""Finds the maximum value in a list of numbers"""
# Write your code here.
max = 0
for i in range(len(list)):
if list[i] > max:
max = list[i]
return maxTest Input: print(find_max([5, 42, 17, 8, 1]))
Expected Output: 42
Actual Output: 42
Success: True
Output Matches: False
def count_vowels(string):
"""
>>> count_vowels('Hello')
5
>>> count_vowels('Hello world')
6
"""
return len([c for c in string if c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u'])Test Input: print(count_vowels("hello"))
Expected Output: 2
Actual Output: 2
Success: True
Output Matches: False
def fibonacci(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fibonacci(n-2) + fibonacci(n-1)
t(fibonacci(5))Test Input: print(fibonacci(5))
Expected Output: [0, 1, 1, 2, 3]
Actual Output: Runtime Error: name 'fibonacci' is not defined
Success: False
Output Matches: False
def celsius_to_fahrenheit(temp):
return (temp * 9/5) + 32Test Input: print(celsius_to_fahrenheit(37))
Expected Output: 98.6
Actual Output: 98.6
Success: True
Output Matches: False