Correct the given solution (for 02)
Sign in to test your solution.
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
You can submit as many times as you like. Only your latest submission will be taken into account.
Sign in to test your solution.
Python sandbox
This window allows you to run Python code without installing a thing. The code you write here is not automatically submitted to Dodona.
Test case being debugged