Kontrollfluss/Programmfluss

# change this code
number = 5
second_number = 10
first_array = []
second_array = [4,5,6]

if number > 15:
    print("1")

if first_array:
    print("2")

if len(second_array) == 2:
    print("3")

if len(first_array) + len(second_array) == 5:
    print("4")

if first_array and first_array[0] == 1:
    print("5")

if not second_number:
    print("6")

For-Schleifen

primzahlen = [2, 3, 5, 7]
for prime in primzahlen:
    print(prime)
2
3
5
7

while

namen = ["Petra", "Paula", "Pia", 'Pamela', 'Paola', 'Patricia', 'Paula', 'Paulina']
namen += ['Pauline','Penelope','Petra']
while len(namen) > 0:
  print(namen)
  print(namen.pop())
['Petra', 'Paula', 'Pia', 'Pamela', 'Paola', 'Patricia', 'Paula', 'Paulina', 'Pauline', 'Penelope', 'Petra']
Petra
['Petra', 'Paula', 'Pia', 'Pamela', 'Paola', 'Patricia', 'Paula', 'Paulina', 'Pauline', 'Penelope']
Penelope
['Petra', 'Paula', 'Pia', 'Pamela', 'Paola', 'Patricia', 'Paula', 'Paulina', 'Pauline']
Pauline
['Petra', 'Paula', 'Pia', 'Pamela', 'Paola', 'Patricia', 'Paula', 'Paulina']
Paulina
['Petra', 'Paula', 'Pia', 'Pamela', 'Paola', 'Patricia', 'Paula']
Paula
['Petra', 'Paula', 'Pia', 'Pamela', 'Paola', 'Patricia']
Patricia
['Petra', 'Paula', 'Pia', 'Pamela', 'Paola']
Paola
['Petra', 'Paula', 'Pia', 'Pamela']
Pamela
['Petra', 'Paula', 'Pia']
Pia
['Petra', 'Paula']
Paula
['Petra']
Petra