+ 1

Can someone please help explain "THAT ODD" code coach

I've been trying to solve these code coach buy I'm guessing that my interpretation to the question is wrong cause I've tried several means and still I've not been able to solve it... Here's my recent approach user = int(input()) test = user + 1 output = 0 for i in range (test): if i % 2 == 0: output += i print (output) My code works fine on my ide but solo learn keeps saying I'm wrong 😔

12th Mar 2022, 5:47 PM
Stanley Chikweru
Stanley Chikweru - avatar
8 Antworten
+ 2
thank you FF9900 my new code now is: user = int(input()) test = user + 1 output = 0 for i in range (test): user_values = int(input()) if user_values % 2 == 0: output += user_values print (output) but the peoblem now is i'm greeted with an end of file(eof) error
12th Mar 2022, 6:53 PM
Stanley Chikweru
Stanley Chikweru - avatar
+ 2
FF9900 thanks buddy for your time and effort....I've gotten it and it still keeps me to yet wanna ask another question I commented out the line that says test and get to notice that the range function actually acted strange cause it reached the signified numbered instead of leaving the last number. Any explanation to this
12th Mar 2022, 7:06 PM
Stanley Chikweru
Stanley Chikweru - avatar
+ 1
FF9900 ok then, gimme a minute
12th Mar 2022, 6:58 PM
Stanley Chikweru
Stanley Chikweru - avatar
+ 1
FF9900 funny me.....I forgot that range starts it count from 0, thanks for the reminder and once again thanks for your time and effort
12th Mar 2022, 7:19 PM
Stanley Chikweru
Stanley Chikweru - avatar
0
FF9900 that was a mistake....i've re-edited it
12th Mar 2022, 5:52 PM
Stanley Chikweru
Stanley Chikweru - avatar
0
FF9900 this is the same explanation i gave while writing the code but after clicking on result i see a whole bunch of red and i don't know why
12th Mar 2022, 6:02 PM
Stanley Chikweru
Stanley Chikweru - avatar
0
FF9900 so sorry to stress you out, I don't really understand this
12th Mar 2022, 6:18 PM
Stanley Chikweru
Stanley Chikweru - avatar
0
FF9900 ok, lemme try again and get back to you
12th Mar 2022, 6:33 PM
Stanley Chikweru
Stanley Chikweru - avatar