C02_list/list_klausur.py

27 lines
548 B
Python

class Element:
def __init__(self, data):
self.data = data
self.next = None
class Liste:
def __init__(self):
self.head = None
def insert(self, value):
new_element = Element(value)
new_element.next = self.head
self.head = new_element
def remove(self):
pass
def func(self):
current = self.head
m = 0
while current is not None:
if current.data >= m:
m = current.data
current = current.next
return m