Prerequisites exam python_exam task1.py

Hi, I have been dealing this for the whole day, but system told me that it is still wrong. However, I got it right when I test it.


I have also removed the calling: “l = get_highest_lowest()”

Hello @sp_jason ,

Sorry for the late response. Could you please send me your package to my e-mail (aezquerro@theconstructsim.com) so that I can have a look at it?

Best,

Hi @sp_jason,

It seems a bit old topic, but it is still open and my contribution might be still valid.

I checked your code and I think you are initializing the minim = 0 value incorrectly. Since the sensor readings are greater than 0 you will always return with 0 as the lowest value. You should set an arbitrarily large number or the first reading as a default value.

Furthermore, the exam could have been changed, but the latest task request to return the position in the list of those extremes, not their value.

1 Like

Hello @albertoezquerro

I’m stuck on returning the Position of the of the 2 values on task 1. my method returns the values any clue on how to return the position?

best regards

think I’ve got it using a for loop:
for position, item in enumerate(l):
this wasn’t covered in the course, am i missing something?

1 Like