How can i find greater numbers in a list than one other number? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i find greater numbers in a list than one other number?

If i have a list with some numbers ill need to print the numbers that are greater than 10 or 5.

20th May 2017, 7:17 AM
Mario Alla
Mario Alla - avatar
2 Answers
+ 4
Assuming you want to do it with Python ( as you talk about 'list' ): list = [ 42, 5, 80, 127, 3] for x in list: if x > 5 or x > 10: # but unnecessary: if x>10, then x>5 ;) print(str(x)+' is greater than 5 or 10')
20th May 2017, 7:38 AM
visph
visph - avatar
+ 2
In which language?
20th May 2017, 7:37 AM
Maart
Maart - avatar