Test Cases Code Blocks¶
Code Block Python¶
# Python 3: Fibonacci series up to n
>>> def fib(n):
>>> a, b = 0, 1
>>> while a < n:
>>> print(a, end=' ')
>>> a, b = b, a+b
>>> print()
>>> fib(1000)
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987
def some_function():
interesting = False
print 'This line is highlighted.'
print 'This one is not...'
print '...but this one is.'
>>> while True print('Hello world')
File "<stdin>", line 1
while True print('Hello world')
^
SyntaxError: invalid syntax
>>> 10 * (1/0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: division by zero
1class Error(Exception):
2 """Base class for exceptions in this module."""
3 pass
4
5class InputError(Error):
6 """Exception raised for errors in the input.
7
8 Attributes:
9 expression -- input expression in which the error occurred
10 message -- explanation of the error
11 """
12
13 def __init__(self, expression, message):
14 self.expression = expression
15 self.message = message
1def some_function():
2 interesting = False
3 print 'This line is highlighted.'
4 print 'This one is not...'
5 print '...but this one is.'
def some_function():
print 'This one is not...'
def some_function():
print 'This one is not...'
def some_function():
print 'This one is not...'
def some_function():
print 'This one is not...'
def some_function():
print 'This one is not...'
def some_function():
print 'This one is not...'
def some_function():
print 'This one is not...'