Teil 6 "Objekte ist neu

Repository aufgeräumt.
This commit is contained in:
2023-02-24 06:41:05 +01:00
parent c21159f36f
commit 3d8cb9128d
34 changed files with 196 additions and 0 deletions

View File

@@ -1,7 +0,0 @@
# coding = 'utf-8'
s1 = 'Homer'
s2 = '1969'
s3 = 'Dies ist ein ganzer Satz.'
s4 = 'Auf den Alkohol - Der Beginn und die Lösung sämtlicher Lebenprobleme. (Homer Simpson)'

View File

@@ -0,0 +1,9 @@
PI = 3.1415
r=10
def berechne_flaecheninhalt():
a = PI * r**2
return a
flaeche = berechne_flaecheninhalt()
print(f"Der Flächeninhalt beträgt: {flaeche}")

View File

@@ -1,5 +0,0 @@
import math
print(f'Pi ist {math.pi}')
print(f'Pi ist {math.pi:.2f}')

View File

@@ -1 +0,0 @@
print('Homer'.lower().find('home'.lower()))

View File

@@ -1,12 +0,0 @@
def find_in_string(s, c):
for pos in range(0,len(s)):
if(s[pos] == c):
return pos
return -1
print(find_in_string('Homer','e'))
print(find_in_string('Homer','n'))

View File

@@ -1,5 +0,0 @@
print('Homer'.find('e'))
print('Homer'.find('n'))

View File

@@ -1,2 +0,0 @@
print('Homer'.find('Home'))
print('Homer'.find('home'))

View File

@@ -1,6 +0,0 @@
a=5
b=10
produkt = a * b
print(f'Das Produkt aus {a} und {b} ist {produkt}')

9
teil3/import.py Normal file
View File

@@ -0,0 +1,9 @@
import math
#PI = 3.1415
def berechne_flaecheninhalt(r):
a = math.pi * r**2
return a
flaeche = berechne_flaecheninhalt(10)
print(f"Der Flächeninhalt beträgt: {flaeche}")

14
teil3/kommentare.py Normal file
View File

@@ -0,0 +1,14 @@
#math Package importieren
import math
#PI = 3.1415
# berechnet den Flächeninhalt eines Kreises
# mit dem Radius r
# Parameter: r - Radius des Kreises
def berechne_flaecheninhalt(r):
a = math.pi * r**2
return a
flaeche = berechne_flaecheninhalt(10)
print(f"Der Flächeninhalt beträgt: {flaeche}")

7
teil3/kreis.py Normal file
View File

@@ -0,0 +1,7 @@
PI = 3.1415
r=10
a = PI * r*r
print(f'Der Flächeninhalt beträgt: {a}')

9
teil3/parameter.py Normal file
View File

@@ -0,0 +1,9 @@
PI = 3.1415
def berechne_flaecheninhalt(r):
a = PI * r**2
return a
flaeche = berechne_flaecheninhalt(10)
print(f"Der Flächeninhalt beträgt: {flaeche}")

View File

@@ -1,7 +0,0 @@
s = 'Dies ist ein ganzer Satz.'
print(f'zerlegt= {s.split()}')
werte = '1,2,3,4,5,6,7,8,9'
print(f'werteliste = {werte.split(",")}')

View File

@@ -1,3 +0,0 @@
print('Homer'.lower())
print('Homer'.upper())
print('homer'.capitalize())

View File

@@ -1,5 +0,0 @@
s = 'Homer'
for pos in range(0,len(s)):
print(s[pos])

View File

@@ -1,3 +0,0 @@
s1 = 'Homer'
print(len(s1))

View File

@@ -1,5 +0,0 @@
s= ' mit Leerzeichen '
s = s.strip()
print(f'*{s}*')

View File

@@ -1 +0,0 @@
print('dr. nick riviera'.title())