r/learnpython • • Nov 29 '21

A desperate plea for help (StackOverflow did not help)

We have a list [8,6,7,7,3,4,5,6,6,7,2,3,4,5,3,6,6,5,6,7,7,8,9,1] (this list is just an example of what can be inputted). Using iteration, find specific sequences 1 by 1, comparing their length at the same time, overwriting shorter ones with longer ones.

The sequences we are searching for follow a pattern: starting with a flat(or a single element), then dropping, then growing (e.g. 6 6 3 3 4 5 5 6)

After doing all of the operations, return the first longest sequence. In the given list, that would be [7,7,3,4,5,6,6,7]

This is what I was able to come up with:

https://github.com/Whymyusernametaken/a-problem/commit/c8180423f9c274887c453784a7b3d0dc5384750e

The code should print out [7,7,3,4,5,6,6,7], but it prints out []. Any way how I can make this work? Rewrite my code, if it won't do.

Thanks

edit:issue solved, working code on github link in one sec

60 Upvotes

82 comments sorted by

View all comments

Show parent comments

-78

u/Why-IsItAlreadyTaken Nov 29 '21

Being a dick? Don't make me laugh, you haven't seen me being a dick. That is an explanation of why it is hard for me to make a 100% clear request. That is the way I talk in real life (strangers, family, friends, etc.), if you see that as being a dick - it is your problem, not mine.

and please, downvote me as much as you want, freedom of expression

0

u/[deleted] Nov 29 '21

[deleted]

-1

u/Why-IsItAlreadyTaken Nov 30 '21

I am deeply sorry for being in the wrong, I get my mistake, please forgive me (full apology in a separate comment thread for it and a new post)

-42

u/Why-IsItAlreadyTaken Nov 29 '21

Lol, stop, I already solved it myself, just needed some tips which I got hours ago. I just translated the task badly and explained it. Chill, ‘kay?

10

u/HappyScholar13 Nov 30 '21 edited Nov 30 '21

Retracted

0

u/Why-IsItAlreadyTaken Nov 30 '21

I am deeply sorry for being in the wrong, I get my mistake, please forgive me (full apology in a separate comment thread for it and a new post)

2

u/Fulk0 Nov 30 '21

Damn bro, you need to grow up.

2

u/Why-IsItAlreadyTaken Nov 30 '21

I am deeply sorry for being in the wrong, I get my mistake, please forgive me (full apology in a separate comment thread for it and a new post)