Warning! It seems that you are using Dodona within another webpage, so not everything may work properly. Let your teacher know so that he can solve the problem by adjusting a setting in the learning environment. In the meantime, you can click this link to open Dodona in a new window.
Warning! The page was not fully loaded, probably because of a network issue. It could be that not all functionalities work as expected. Please try reloading the page.
Python exercise
Correct the given solution (for 02)
Sign in to hand in your solution and get feedback.
tekst = input ('Geef 5 getallen gescheiden door een spatie: ')
# 5 getallen opslaan in strlijst
strlijst = tekst.split()
# lege intlijst aanmaken en 5 getallen als int toevoegen
intlijst = []
for strgetal in strlijst:
intlijst.append(int(strgetal))
# door intlijst lopen en elk element vergelijken met zijn voorganger
index = 2 # we beginnen bij het tweede element
while index < len(intlijst)-1 :
if intlijst[index] < intlijst[index]-1:
print(intlijst[index], 'is kleiner dan zijn voorganger.')
elif intlijst[index] = intlijst[index-1]:
print(intlijst[index], 'is gelijk aan zijn voorganger.')
else intlijst[index] > intlijst[index-1]:
print(intlijst[index], 'is groter dan zijn voorganger.')
index + 1