init commit
This commit is contained in:
commit
52146ff04a
11
beschreibmich.txt
Normal file
11
beschreibmich.txt
Normal file
@ -0,0 +1,11 @@
|
||||
meganega
|
||||
meganega
|
||||
meganega
|
||||
meganega
|
||||
meganega
|
||||
meganega
|
||||
meganega
|
||||
meganega
|
||||
meganega
|
||||
meganega
|
||||
meganega
|
||||
20
einundausgabe.py
Normal file
20
einundausgabe.py
Normal 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
11
fileread.py
Normal 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
10
forloop.py
Normal 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
9
functions.py
Normal 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
27
ifelse.py
Normal 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")
|
||||
Loading…
Reference in New Issue
Block a user