Teil 6 "Objekte ist neu
Repository aufgeräumt.
This commit is contained in:
@@ -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)'
|
||||
|
9
teil3/berechne_flaeche.py
Normal file
9
teil3/berechne_flaeche.py
Normal 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}")
|
@@ -1,5 +0,0 @@
|
||||
import math
|
||||
|
||||
|
||||
print(f'Pi ist {math.pi}')
|
||||
print(f'Pi ist {math.pi:.2f}')
|
@@ -1 +0,0 @@
|
||||
print('Homer'.lower().find('home'.lower()))
|
@@ -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'))
|
||||
|
@@ -1,5 +0,0 @@
|
||||
|
||||
|
||||
print('Homer'.find('e'))
|
||||
print('Homer'.find('n'))
|
||||
|
@@ -1,2 +0,0 @@
|
||||
print('Homer'.find('Home'))
|
||||
print('Homer'.find('home'))
|
@@ -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
9
teil3/import.py
Normal 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
14
teil3/kommentare.py
Normal 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
7
teil3/kreis.py
Normal 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
9
teil3/parameter.py
Normal 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}")
|
@@ -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(",")}')
|
@@ -1,3 +0,0 @@
|
||||
print('Homer'.lower())
|
||||
print('Homer'.upper())
|
||||
print('homer'.capitalize())
|
@@ -1,5 +0,0 @@
|
||||
s = 'Homer'
|
||||
|
||||
for pos in range(0,len(s)):
|
||||
print(s[pos])
|
||||
|
@@ -1,3 +0,0 @@
|
||||
s1 = 'Homer'
|
||||
|
||||
print(len(s1))
|
@@ -1,5 +0,0 @@
|
||||
s= ' mit Leerzeichen '
|
||||
|
||||
s = s.strip()
|
||||
print(f'*{s}*')
|
||||
|
@@ -1 +0,0 @@
|
||||
print('dr. nick riviera'.title())
|
Reference in New Issue
Block a user