Anfang von ordentlichen Programmieren

This commit is contained in:
Rsclub2 2 2022-02-03 14:07:31 +01:00
parent 0dfcb20714
commit 16044ee415
3 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,58 @@
def init():
print("Hallo und willkommen zum Endnotenberchnungsprogramm!")
print("Bitte gib an, welches Programm du starten willst:")
print("1. Endnotenberechnung mit Kursarbeit")
print("2. Endnotenberechnung ohne Kursarbeit")
user_input = input()
if user_input == "1":
main()
elif user_input == "2":
ohne_kursarbeit()
else:
print("Bitte nur 1 oder 2 eingeben")
init()
def main():
print("Hallo und willkommen zum Endnotenberchnungsprogramm!")
print("Bitte gib die Anzahl der normalen Noten ein:")
normale_noten = input()
# Make an Array with the these numbers
normale_noten_array = []
for i in range(0, int(normale_noten)):
print("Bitte gib die Note ein:")
note = int(input())
normale_noten_array.append(note)
alle_noten_zusammen = sum(normale_noten_array)
# Get Avarage of the normal Notes
avarage_normale_noten = alle_noten_zusammen / int(normale_noten)
# Multiply avarage of the normal notes with 2/3
avarage_normale_noten_2_3 = avarage_normale_noten * 2 / 3
print("Bitte gib die Note der Kursarbeit ein:")
kursarbeit = int(input())
kursarbeit_1_3 = kursarbeit * 1 / 3
endnote = int(kursarbeit_1_3) + int(avarage_normale_noten_2_3)
print("Deine Endnote ist: " + str(endnote))
def ohne_kursarbeit():
print("Hallo und willkommen zum Endnotenberchnungsprogramm!")
print("Bitte gib die Anzahl der normalen Noten ein:")
normale_noten = input()
# Make an Array with the these numbers
normale_noten_array = []
for i in range(0, int(normale_noten)):
print("Bitte gib die Note ein:")
note = int(input())
normale_noten_array.append(note)
alle_noten_zusammen = sum(normale_noten_array)
# Get Avarage of the normal Notes
avarage_normale_noten = alle_noten_zusammen / int(normale_noten)
print(avarage_normale_noten)
init()
print("Nochmal rechnen ((J)a/(N)ein)?")
start = input()
if start == "J" or start == "ja":
init()
else:
print("Auf Wiedersehen!")
exit()

View File

@ -0,0 +1,8 @@
print("Hallo und Willkommen zum Taschenrechner")
print("Dieser Taschenrechner kann nur addieren.")
print("Bitte gib die erste Zahl ein:")
zahl1 = int(input())
print("Bitte gib die zweite Zahl ein:")
zahl2 = int(input())
print("Die Summe lautet:", zahl1 + zahl2)
exit()