0

# Reverse lists and group

How can I group the reverse list of integers? The output should be grouped on reverse. Example: Input: 5 2 3 1 8 6 My desired Output: [6,8]-[1]-[3,2] I don't know the basis of how this group came to be. The assignment only says to "group them according to your liking with proper code" This is my code: https://code.sololearn.com/cA25a9a14A38

6/16/2021 1:37:53 PM

Brianna

+3

Seems to give your desired output. https://code.sololearn.com/c7J39S3Fb0ph/?ref=app Input: (size of array) 5 (then elements of array) 2 3 1 8 6 Output: [6,8]-[1]-[3,2] I just played around with indices a bit (Not the best solution I guess 😅). Do ask if you have any doubts.

+1

For this question complete the course bit more.As you have completed 13% of it only

+1

Nivya he is expecting this output, I think [6,8] [1,3] [2,5]

+1

Yea Atul may be or anything based on the conditions ,until he gives what it is actually we cant help out!

+1

Emma Thank you so much! But what about if the array size is 7?

+1

Brianna Code will give output, since I wrapped it in try-catch. But from your example I guess I understood it wrong. I thought the task was to group first two consecutive numbers and then group the third number and continue like that.. But then I saw this question. https://www.sololearn.com/Discuss/2814208/?ref=app and maybe the answers in the above questions is your desired output? https://code.sololearn.com/cfhTguBgkUOh/?ref=app  Brianna, You can modify 🅰🅹 🅐🅝🅐🅝🅣 code with commas according to your wish :) https://code.sololearn.com/c6Ao4n1G2MX9/?ref=app

+1

Emma ,The recent code that you gave is actually right, the only problem is that it didn't have a comma between the numbers. (I saw your comment in the other guy's post: It seems we do have the same assignment)

+1

Brianna You're welcome :)

+1

Thank you so much Emma , you're a life saver

0

In the output you are segreegated the reversed integers ...on what basis ?sorry, I didn't understand that part...