SimeonTs

SUPyF2 Lists Basics Exercise - 06. Survival of the Biggest

Oct 3rd, 2019
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. """
  2. Lists Basics - Exercise
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1725#5
  4.  
  5. SUPyF2 Lists Basics Exercise - 06. Survival of the Biggest
  6.  
  7. Problem:
  8. Write a program that receives a list of integer numbers and a number n.
  9. The number n represents the amount of numbers to remove from the list. You should remove the smallest ones
  10. Input
  11. On the first line you will receive a string (numbers separated by a space),
  12. on the second line you will receive a number n (count of numbers to remove)
  13. Output
  14. Print all the numbers that are left in the list
  15. Example:
  16. Input:
  17. 10 9 8 7 6 5
  18. 3
  19. Output:
  20. [10, 9, 8]
  21. Input:
  22. 1 10 2 9 3 8
  23. 2
  24. Output:
  25. [10, 9, 3, 8]
  26. """
  27. numbers = [int(number) for number in input().split()]
  28. times_to_remove = int(input())
  29. for each_time in range(times_to_remove):
  30.     numbers.remove(min(numbers))
  31. print(numbers)
Add Comment
Please, Sign In to add comment