43 lines
604 B
Python
43 lines
604 B
Python
# 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.")
|
|
''' |