Commit 9a2e8f98 authored by David Paul's avatar David Paul
Browse files

Fix formatting of exercise

parent 15c69de8
......@@ -63,7 +63,7 @@ exercises.append(exercise)
# Exercise 5
exercise = Exercise("Bug Hunting")
exercise.instructions = "Debug the following program:"
exercise.code = "Def factorial(n):\n \"\"\"Calculate the factorial of the given value and return the result.\n\n The factorial of n is the product of all positive integers less than or equal to n. This function does not support negative values - if a negative value is given, this function just returns 1.\n\n Arguments:\n n -- A positive integer\n \"\"\"\n result = 1\n while n != 0:\n n = n - 1\n result = result * n\n return result\n\n# Calculate factorial for the first four integers\nfor i in range(-1, 5):\n print('Factorial of', i, 'is', factorial(i)"
exercise.code = "Def factorial(n):\n \"\"\"Calculate the factorial of the given value and return the result.\n\n The factorial of n is the product of all positive integers less than or equal to n.\n This function does not support negative values - if a negative value is given, this function just returns 1.\n\n Arguments:\n n -- A positive integer\n \"\"\"\n result = 1\n while n != 0:\n n = n - 1\n result = result * n\n return result\n\n# Calculate factorial for the first four integers\nfor i in range(-1, 5):\n print('Factorial of', i, 'is', factorial(i)"
exercise.tests = [Test("Expected output", "Factorial of 1 is 1\nFactorial of 2 is 2\nFactorial of 3 is 6\nFactorial of 4 is 24\n")]
exercise.checks = [Check("Ensure function begins with \"def\" (not \"Def\")", "def factorial"),
Check("Should you be testing for inequality only?", "!=", True),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment