42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
|
|
import random
|
|
Müllkas = [random.randint(1,10) for i in range(1,11)]
|
|
|
|
|
|
|
|
def first_element(Müllkas):
|
|
print("Das erste Element ist:",Müllkas[0] )
|
|
first_element(Müllkas)
|
|
|
|
def last_element(Müllkas):
|
|
print("Das letzte Element ist:", Müllkas[9])
|
|
last_element(Müllkas)
|
|
|
|
def all_elements(Müllkas):
|
|
print("Alle Elemente des Arrays:")
|
|
for i in range (0,9):
|
|
print(Müllkas[i])
|
|
all_elements(Müllkas)
|
|
|
|
def check_four(Müllkas):
|
|
for i in range (0,9):
|
|
if Müllkas[i] == 4:
|
|
print("Eine 4 an Stelle " + str(i) + " gefunden")
|
|
check_four(Müllkas)
|
|
|
|
def check_chosen(Müllkas):
|
|
chosen = int(input("Geben sie eine Zahl ein:"))
|
|
for i in range (0,9):
|
|
if Müllkas[i] == chosen:
|
|
print("Eine " + str(chosen)+ " an Stelle " + str(i) + " gefunden")
|
|
check_chosen(Müllkas)
|
|
|
|
def double_array(Müllkas):
|
|
for i in range (0,9):
|
|
Müllkas[i] = Müllkas[i]*2
|
|
print(Müllkas)
|
|
double_array(Müllkas)
|
|
|
|
def binär_code(Müllkas):
|
|
for i in range (0,9):
|
|
if Müllkas[i]== |