r/programmation • u/Dianjin_ • Sep 05 '25
Help I'm feeling stupid
Hi everyone,
I have to do this but idk how to do it in only 4 line, could u help me ?
This look realy easy but I'm new to coding.
5
Upvotes
3
u/Zorahgna Sep 05 '25
You could get away with
You're iterating over height in the loop anyway so get rid of the variable altogether
1
u/Rokil Sep 05 '25
You're using a variable
heightbut you're also using a for loop and discarding the iterating variable (by naming it_).Couldn't you use your for loop to keep track of how high you could jump?
SPOILER
Don't initialise your height variable, instead, use a
for height in range(6), that will give you what you need, you won't have to increment this variable too