In [1]:
x
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-401b30e3b8b5> in <module>()
----> 1 x

NameError: name 'x' is not defined
In [2]:
x=3
In [3]:
x
Out[3]:
3
In [4]:
x*x
x
Out[4]:
3
In [5]:
print(x*x)
print(x)
9
3
In [6]:
def f(x):
    y=x*x
    return y
In [7]:
f(3)
Out[7]:
9
In [8]:
def g(x):
    if x>0:
        y=x*x
        print('y=',y)
        print('ancora dentro l\'if')
    if x<=0:
        y=-x
        print('y=',y)
        if x==0:
            y=0 # qui fa zero
        
    return y
In [9]:
g(2)
y= 4
ancora dentro l'if
Out[9]:
4
In [10]:
import uncertainties
In [13]:
z=uncertainties.ufloat(12,2)
t=uncertainties.ufloat(12,3)
In [14]:
z+t
Out[14]:
24.0+/-3.605551275463989
In [15]:
from uncertainties import ufloat
In [16]:
p=ufloat(12,2)
q=ufloat(22,4)
In [17]:
p-q
Out[17]:
-10.0+/-4.47213595499958
In [18]:
from uncertainties import ufloat as fl
In [19]:
k=fl(12,2)
j=fl(12,2)
In [20]:
k*j
Out[20]:
144.0+/-33.94112549695428