Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
list evaluation
#3
You have a row of alternating green and red bricks. It starts with the green brick and has an index of 0.
Then a red brick with the index 1 follows. Then again a green brick with index 2... and so on

You can't see colors. You can see only the index numbers and you were told, that the index 0 starts with a green brick.
Your task is the same.

You have a list with even and odd elements. Just read more about the slice notation / index access of sequences.
Two or one compact line code solves the problem.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
list evaluation - by go127a - Apr-12-2019, 10:27 AM
RE: list evaluation - by Larz60+ - Apr-12-2019, 10:34 AM
RE: list evaluation - by DeaD_EyE - Apr-12-2019, 11:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  UndefinedEnvironmentName: 'extra' does not exist in evaluation environment EarthAndMoon 3 1,621 Oct-09-2023, 05:38 PM
Last Post: snippsat
  Conditional evaluation stsxbel 7 3,421 Jun-13-2021, 08:27 PM
Last Post: Gribouillis
  Evaluation of two different list in python? go127a 8 3,547 Apr-22-2019, 12:49 PM
Last Post: snippsat
  operand evaluation order? insearchofanswers87 2 2,791 Sep-26-2018, 07:51 PM
Last Post: insearchofanswers87
  Recursive evaluation in parsley parser mqnc 0 2,555 Apr-13-2018, 09:02 PM
Last Post: mqnc
  Learning Python, newbie question about strings and evaluation new_learner_999 13 5,862 Feb-18-2018, 03:01 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020