A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a Python program to move all zero digits to end of a given list of numbers
Q:

Write a Python program to move all zero digits to end of a given list of numbers

0

Write a Python program to move all zero digits to end of a given list of numbers

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def test(lst):
    result = sorted(lst, key=lambda x: not x) 
    return result
nums = [3,4,0,0,0,6,2,0,6,7,6,0,0,0,9,10,7,4,4,5,3,0,0,2,9,7,1]
print("\nOriginal list:")
print(nums)
print("\nMove all zero digits to end of the said list of numbers:")
print(test(nums)) 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now