Question for the 1st exercise of the "Exasol Database Development" course

mdunkel
Contributor

Hallo,

 

Ich bräuchte Hilfe zum 1. Übungsbeispiel des Kurses "Exasol Database Development"

Obwohl ich denke mit meiner Funktion die Fragestellung zu erfüllen, kriege ich ein "Incorrect" von der Auto-Korrektur.

Die Meldung ist: "The prefix is not added properly to the elements"

Ich habe einen screenshot angehängt, wo das Problem zu sehen ist. Vielleicht kann jemand helfen.

 

liebe Grüße,

Markus

 

Translation:

Hello,

I need help with the 1st exercise of the course "Exasol Database Development".

Although I think I fulfill the question with my function, I get an "Incorrect" from the auto-correction.

The message is: "The prefix is not added properly to the elements".

I have attached a screenshot where you can see the problem. Maybe someone can help.

 

Best regards,

Markus

 

1 ACCEPTED SOLUTION

Accepted Solutions

exa-Uwe
Moderator
Moderator

Hi Markus,

your solution works, but our parser didn't expect the usage of the deprecated lua function table.getn.

It is not recommended to use deprecated functions, as they may be removed in future versions. Therefore, instead of changing the parser code to accept your solution, I suggest you use the valid # operator (#items) instead.

With that modification, your code should get accepted by the parser.

Best regards

Uwe

View solution in original post

4 REPLIES 4

exa-Uwe
Moderator
Moderator

Hi Markus,

instead of a screenshot, please share the code in form of text that we can copy and check directly.

It might be okay - the system that parses your solution isn't perfect and misses a valid solution sometimes.

Best regards

Uwe

mdunkel
Contributor

Hi Uwe,

 

Sorry for the inconvenience. Here is the code:

 

function add_prefix(items, prfx)
  out = {}
  for i=1, table.getn(items) do
    out[i] = prfx..items[i]
  end
  return table.concat(out,", ")
end

print(add_prefix( {'firstname', 'lastname', 'city'}, 'person.'))

 

Best regards,
Markus

exa-Uwe
Moderator
Moderator

Hi Markus,

your solution works, but our parser didn't expect the usage of the deprecated lua function table.getn.

It is not recommended to use deprecated functions, as they may be removed in future versions. Therefore, instead of changing the parser code to accept your solution, I suggest you use the valid # operator (#items) instead.

With that modification, your code should get accepted by the parser.

Best regards

Uwe

View solution in original post

mdunkel
Contributor

Hi Uwe,

Thank you! That is good to know.

Best regards,
Markus