Feb-09-2024, 04:51 PM
@deadkill02
For the rest of this task, I would create a 'new tokens' list object, then nest two
In the first loop, create a 'new token' string:
In the second loop, have an
Do you know why I have
When that's done,
It is in fact, far more work to describe this as I have, than it is to write the code, but give it a shot and if you get stuck, simply post back with what you have and I'll guide you some more.
For the rest of this task, I would create a 'new tokens' list object, then nest two
for
loops; one to loop through the existing tokens, and the other to loop though the numbers (which will be string objects, don't forget) within the tokens:for token in ccn_lst:
for index, item in enumerate(token):
In the first loop, create a 'new token' string:
new_token = ""
In the second loop, have an
if/else
branch the checks the index
number in range(1, 4, 2)
and build up the 'new_token' string, from that branch.Do you know why I have
(1, 4, 2)
?When that's done,
.append()
the 'new token' to the 'new tokens' list, at which point, the second loop is finished and the first loop will grab the next token in the 'ccn_lst'.It is in fact, far more work to describe this as I have, than it is to write the code, but give it a shot and if you get stuck, simply post back with what you have and I'll guide you some more.
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein