This commit is contained in:
2022-03-31 14:35:56 +02:00
parent c1a450e547
commit aff8164a5c
5 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,12 @@
# Programm, welches wiederholend dividiert (bis zu Untergrenze)
x = round((float(input("Gebe x ein:"))),2)
# Verarbeitung mittels while
untergrenze=1
index=0
while x>untergrenze:
x=x/2
index=index+1
print(x)
print("Es wurde %smal durch 2 geteilt"%(index))

View File

@ -0,0 +1,43 @@
# Programm, welches die While-Schleife einführt
'''
# Standard
i=1
while i<=6:
print(i)
i=i+1
'''
''''
# Zusatz1: break
i=1
while i<=6:
print(i)
if i==3:
print("Herr Kaiser macht %s Sachen"%(i))
break
i=i+1
'''
'''
i=0
# Zusatz2: continue (anfang der While-Schleife)
while i<=6:
i=i+1
if i==3:
print("Herr Kaiser macht %s Sachen"%(i))
continue
print(i)
'''
'''
i=1
# Fallunterscheidung innerhalb einer While-Schleife
while i<=6:
print(i)
i=i+1
else:
print("Robin ist ein Hurensohn\r\ni ist nicht mehr kleiner als 6.")
'''