tokens = ( 'IDENTIFIER', 'NUMBER', 'STRING' ) def t_NUMBER(t): r'-?[0-9]+(?:\.[0-9]*)?' t.value = float(t.value) return t def t_STRING(t): r'([^"\\]|(\\.))*"' t.value = t.value[1:-1] return t
function gcd(a,b){
if(a==b){
return a;
} else {
if(a > b){
return gcd(a-b, b);
} else {
return gcd(a, b- a)
}
}
}
recursion: function call itself
javascript and python
def uptoten(x):
if x < 10:
return x
else:
return 10
javascriptcode="""
function uptoten(x) {
if x < 10 {
return x
} else {
return 10
}
}
"""
[/python]