In [1]:
x = 2
y = 3
print x**2.
print y**2.
In [7]:
#def name():
# Befehle
# Beefehl2
def rechne(u):
return (u**2. + 3.)/70.
l = [2.,3.,10.,12.,15.,121]
for x in l:
print rechne(x)
# hier sind 5000 Zeilen code dazwischen
z = 6.
print rechne(z)
In [18]:
def barbecue_weather(rain, temp):
# should return True/False
if rain > 0.:
barbecue = False
else:
if temp > 20.:
barbecue = True
else:
barbecue = False
return barbecue
def barbecue_weather2(rain, temp):
# should return True/False
res = False
if (rain==0.) and (temp>20.):
res = True
return res
def barbecue_weather3(rain=0., temp=0.): # Namen vergibt man so
# should return True/False
res = False
if (rain==0.) and (temp>20.):
res = True
return res
regen=20.
temp = 5.
print barbecue_weather3(temp=temp, rain=regen)
print barbecue_weather3(rain=regen,temp=temp)
Funktionsargumente
In [11]:
def tunix():
print('ich bin faul...')
r = tunix()
In [16]:
print(r)
print(r is None)
print(r == None)
In [ ]: