-
Notifications
You must be signed in to change notification settings - Fork 0
/
example1.py
44 lines (35 loc) · 1.47 KB
/
example1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#! /usr/bin/env python
#A miniPython example
#Tested Productions Goal, Function, Argument.
#Tested Statements: if, while, for, return, print, assign, assert, function call.
#Tested Expressions: Arithmetics, arrays, function calls, values, identifiers,
# ++, --, type(x), max, min, (expression), [] blocks
#Tested Comparisons: Logical precedence
#Tested Productions Function Call, Arglist, Value, Number, Identifier from the above examples.
def fib(): # write Fibonacci series up to n
a = 0
b = 1
while not a < n or (3+2)*a>2 and not true:
print type(a)
a = b
b = (a-2*a[3])++ + a.fib(v+3) ** (4 + 3 ** a) % 2
#Array Test
array[a+3] = e**(4+3)
#Assign Tests
c -= 3
d /= 1 + a
#MinMax Tests
print min(a.fib(n), None, 'henlo')
print max(a.fib(n), None, "henlo")
#Assert Tests
assert max(a.fib(), 32), fib()++
assert min(34, None)
#FunctionCall Tests
fib()
fib(a, "stringTest", b + 3%(2+5))
def funcwithdef(name,university="aueb"):
if 5+4>a or not b>c:
for search_element in list:
print ['a',3,a.fib(a)]
print name, " studies in ", (university + ' AUEB.')
return (name + 'a')