Пример #1
0
def p_addition(p):
    '''addition : term
                | term addOP addition'''
    from java.lang import Math
    import Addition
    if len(p) == 4 and isinstance( p[1], int ) and isinstance( p[3], int ):
        print "Calling java Math: ", Math.max(p[1], p[3])
        print "Calling java Addition.add: ", Addition.add(p[1], p[3])
    if len(p) == 4: p[0] = str(p[1]) + str(p[2]) + str(p[3])
    else : p[0] = p[1]
Пример #2
0
#Style1
import Addition

print(Addition.add(4, 5))
print(Addition.add(14, 5))
print(Addition.add2(14, 15))
print(Addition.add2(14))

#Style2
from Addition import *

print(add(4, 5))
print(add(14, 5))
print(add2(14, 15))
print(add2(14))
Пример #3
0
import Addition
print(Addition.add(10,20))
print(__name__)