I want to write a code , that contains a while loop that only stops once the element of the list is the number 9. What is returned is a list of all of the numbers up until it reaches 9. So what it shouldn´t do : have all numbers except 9 , or all numbers that are smaller / bigger than 9 . It should just contain all numbers of a list untill the list reaches 7 . (See example below)
different operators
def hello (list):
return[ x for x in [7, 8, 3, 2, 4, 9, 51] if x < 9]
def check_nums (list):
return [x for x in list if x >9]
i expected the output of for example [0,2,4,9,2,3,6,8,12,14,7,9,10,8,3] to be [0, 2, 4, 9, 2, 3, 6, 8, 12, 14] .