def x_hoch_y(x, y): | |||||
return x**y | |||||
#alternativ: return pow(x,y) | |||||
print("13 hoch 7 ist: ", x_hoch_y(13,7)) | |||||
print("2 hoch 9 ist: ", x_hoch_y(2,9)) | |||||
print("4 hoch 2 ist: ", x_hoch_y(4,2)) |
listA = [2, 4.4, "HiHi", 15, 6.97] | |||||
listB = [12, 82, "BlaBla"] | |||||
listC = listA + listB | |||||
print("listC: ", listC) | |||||
listC.reverse() | |||||
print("listC reverse: ", listC) | |||||
#print("listC sort: ", listC.sort()) |
print("Das Eis kostet %.2f Euro" % ( 1.8 ) ) | |||||
print("Die Vorlesung startet um %2d:%2d Uhr" % ( 9, 45 )) | |||||
print("Die Vorlesung startet um %02d:%02d Uhr" % ( 9, 45 )) |
myData = {"first":"Jonka", "last":"Winkle", "day":10, "month":11, "year":1995} | |||||
print("Ganzer Name: ", myData["first"], myData["last"]) | |||||
print("Geburtsdatum: ", myData["day"], myData["month"], myData["year"]) | |||||
def geburtstag(dictio): | |||||
returnStr = str(dictio["day"]) + "." + str(dictio["month"])+ "." + str(dictio["year"]) | |||||
#alternativ: returnStr = "{:02d}.{:02d}.{:04d}".format(dictio["day"], dictio["month"], dictio["year"]) | |||||
return returnStr | |||||
print("Hier das Ergebnis der geburtstag()-Fkt: ", geburtstag(myData)) |
print("Es hat geklappt!") |