Computer Science, asked by praveenyadav032003, 5 months ago

Write a function Display(num) in Python, which accepts a list num and prints
number which are ending with 0 in first line and remaining numbers in second
line.
Sample Input Data of the list num
num= [ 10,20,32,40,12,110]
Output
10 20 40 110
32 12


Sin90: hey buddy, nice try! You are from my class right? lol lol .. Asking answers during exam? haha

Answers

Answered by jai696
8

\large\mathsf\color{pink}{Solution\: using\: python\: 3}

def Display(nums):

end_0 = [n for n in nums if n % 10 == 0]

rest = [n for n in nums if n not in set(end_0)]

for arr in [end_0, rest]:

print(*arr, sep = ", ")

nums = [10, 20, 32, 40, 12, 110]

Display(nums)

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Answered by nerdier
2

Answer:

def display(num):

   stk=[]

   stk1=[]

   lh=len(num)

   for i in range(0,lh):

       if num[i]%10==0:

           stk.append(num[i])

       else:

           stk1.append(num[i])

   print(stk)

   print(stk1)

num=[10,20,32,40,12,110]

display(num)

Similar questions