Checking the order

  • 5
  • Locked
Hierarchy is a dictator's first tool for maintaining order and military control. We'll think about a dictatorship later. For now, let's make a list of 10 words. Let's use the keyboard to enter them. Our task is to check whether the list is ordered by increasing string length. If not, we'll display the index of the first element that violates this order.
You can't complete this task, because you're not signed in.
Comments (25)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Jon Ander Ochoa Ruiz
Level 8 , Greensboro, United States
3 April 2022, 11:46
Hi I don´t know what´s the problem. The last task is wrong and I don´t know why? Can someone explain me or give me a tip please. Thank so much
John Squirrels Website Admin at CodeGym
4 April 2022, 08:20
Please refer to the Help section.
Andrew Evans
Level 17 , San Jose, Canada
2 February 2022, 03:36
Try an i+1 when you print. Task is extremely precise
Anonymous #10781095
Level 0 , Roxas
2 August 2021, 15:12
Pls iken join fors dis game is cool
Davidh Dionicio
Level 17 , Lima, Peru
24 January 2021, 06:07
A hint, it tells you if the list is in this order according to their increasing length, so if the list has an order of length from least to greatest nothing happens;
hi
Hello
watelok
onetwothree
// nothing is done here because they are already ordered.
but if one of them does not have that order of length less to greater, I mean like:
hi
Hello
hg
watelok
onetwothree
// here the line "he" did not fulfill that order because its length is less than the previous one.
Then you have to show the index or number of the position that violated that rule, that is:
3
Michael
Level 10 , Dresden, Germany
22 October 2020, 19:59
Very confusing description of the task!
Switch/Cypher
Level 25 , Bexleyheath, United Kingdom
12 September 2020, 18:46
/* Comment has been deleted */
andy 6473
Level 9 , Bangalore, India
14 July 2020, 06:45
This is how they are asking you to compare 0 with 1 1 with 2 2 with 3 and so on hope this helps
andy 6473
Level 9 , Bangalore, India
14 July 2020, 06:39
roman explain how the output should occur
Roman
Level 41
14 July 2020, 06:45
For input:
grandfather
grandmother
father
mother
son
daughter
cat
dog
program
car
output is 2 because:
grandfather -> in order (index 0)
grandmother -> in order (index 1)
father -> not in order (index 2)
mother
son
daughter
cat
dog
program
car
Jamie Pyette
Level 9 , Sault Ste. Marie, Canada
17 July 2020, 04:40
Hah, respectfully, this still doesnt make sense IMO. In what way is this not ordered
Jamie Pyette
Level 9 , Sault Ste. Marie, Canada
17 July 2020, 04:45
Nevermind, I get it now. But probably the most confusing description of a task thus far.
Roman
Level 41
17 July 2020, 06:14
2. Determine whether the list is ordered by increasing string length.
Jamie Pyette
Level 9 , Sault Ste. Marie, Canada
18 July 2020, 16:35
Determine whether the list is ordered by (the act of) increasing string length....thats how I read it, totally my fault. Determine whether the list is ordered in a pattern of the strings having increasing lengths...maybe thats too wordy.....anyway, I got er' figured so its all good.
Michael
Level 10 , Dresden, Germany
22 October 2020, 20:03
I read it like"ordered by increasing the length of the string" instead of "ordered by increasing string length"
OBINNA
Level 16 , Texas, United States
16 May 2021, 01:16
I think the output should be 1. because 'grandmother' is not in order. The task said the next input should be in order by increased string length. so 'grandmother' length is the same as 'grandfather' length...so that fails. the index of the string 'grandmother' is 1.
Roman
Level 41
17 May 2021, 05:11
Ok) Try to sort these strings by increased string length
grandfather
grandmother
father
mother
son
daughter
cat
dog
program
car
and show the result)
andy 6473
Level 9 , Bangalore, India
10 July 2020, 16:44
can some one write the output type expected . it is very very confusing
Nickolas Johnson
Level 8 , St. Louis, United States of America
30 March 2020, 13:36
I wrote two different sets of code that both worked and yet only one passed the test. :-/