Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
list evaluation
#1
Hello,
after input and some evaluation I can reach the below list:
[1, 5, 7, 9, 5, 6, 20, 30]
for every number in that list, first number is price and the second number is the quality:
so price is: [1, 7, 5, 20] and the quality is :[5, 9, 6, 30]


i am going to find out the condition lower price and the best quality:
and print out 'its Ok' or 'its not ok'

for example in the upper list 'its not ok'

but for the below list the condition is 'ok'
[1,10,7,3]

the focus of the problem would be using while loop
Reply
#2
Quote:I can reach the below list:
What does this mean?
Please show what you have tried.
Reply
#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


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,420 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,554 Apr-13-2018, 09:02 PM
Last Post: mqnc
  Learning Python, newbie question about strings and evaluation new_learner_999 13 5,861 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