init commit

This commit is contained in:
inhale-dir 2025-04-29 17:38:46 +02:00
commit 52146ff04a
7 changed files with 101 additions and 0 deletions

11
beschreibmich.txt Normal file
View File

@ -0,0 +1,11 @@
meganega
meganega
meganega
meganega
meganega
meganega
meganega
meganega
meganega
meganega
meganega

20
einundausgabe.py Normal file
View File

@ -0,0 +1,20 @@
# Variable füllen
str_auto = "porsche"
int_reifen = 275
float_ps = 512.5
# String einlesen
string_produktionsort = input("Produktionsort: ")
# Diesen String ausgeben
print(string_produktionsort)
# Nur eine Zahl eingeben
int_winterreifen = int(input("Anzahl der benötigten Winterreifen: "))
# Diesen INT ausgeben
print(int_winterreifen)
# cout << "Gebe das und das ein"
# cin >> int_winterreifen
# input("Aufforderung was eingegeben werden muss (ausgabe): ")

11
fileread.py Normal file
View File

@ -0,0 +1,11 @@
# Open file and write
# with open("beschreibmich.txt", "a") as f:
# f.write("meganega\n")
# f.close()
# Open file and read content
with open("beschreibmich.txt", "r") as hs:
# print(hs.read())
file_content = hs.read()
hs.close()
print(file_content)

10
forloop.py Normal file
View File

@ -0,0 +1,10 @@
# car_brands = [2, 8, 7, 3]
# for x in car_brands:
# print(x)
zahl1 = 8
for x in range(3, 10):
zahl1 += 5
print(zahl1)

9
functions.py Normal file
View File

@ -0,0 +1,9 @@
# Eine Funktion in Python heißt Definition
def funktion(zahl1, zahl2):
if zahl1 > zahl2:
print("True")
else:
print("False")
funktion(1, 6)

27
ifelse.py Normal file
View File

@ -0,0 +1,27 @@
# Deklaration von 2 Variablen
int_zahl1 = 5
int_zahl2 = 3
# If/Elif/Else
if int_zahl1 < int_zahl2:
print("Zahl 2 größer als Zahl 1")
elif int_zahl1 > int_zahl2:
print("Zahl 1 größer als Zahl 2")
else:
print("Error")
# Error handling
try:
if int_zahl1 < int_zahl2:
print("Zahl 2 größer als Zahl 1")
elif int_zahl1 > int_zahl2:
print("Zahl 1 größer als Zahl 2")
else:
print("Error")
except:
print("Programm hat fehler")

13
while.py Normal file
View File

@ -0,0 +1,13 @@
# While Loop
zahl1 = 9
zahl2 = 1
# while statement & statement
while zahl1 > zahl2:
zahl2+=1
print(zahl2)
# while true
while True:
print("oki")