Python Forum
list evaluation - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: list evaluation (/thread-17470.html)



list evaluation - go127a - Apr-12-2019

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


RE: list evaluation - Larz60+ - Apr-12-2019

Quote:I can reach the below list:
What does this mean?
Please show what you have tried.


RE: list evaluation - DeaD_EyE - Apr-12-2019

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.