SimeonTs

SUPyF2 Lists-Advanced-Lab - 04. Even Numbers

Oct 9th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. """
  2. Lists Advanced - Lab
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1730#3
  4.  
  5. SUPyF2 Lists-Advanced-Lab - 04. Even Numbers
  6.  
  7. Problem:
  8. Write a program that reads a single string with numbers separated by comma and space ", ".
  9. Print the indices of all even numbers
  10.  
  11. Example:
  12. Input:              Output:
  13. 3, 2, 1, 5, 8       [1, 4]
  14. 2, 4, 6, 9, 10      [0, 1, 2, 4]
  15.  
  16. Hints:
  17. Read the string, split it and convert the list of strings into a list of numbers using lambda.
  18. """
  19. numbers = [int(number) for number in input().split(", ")]
  20. print([numbers.index(number) for number in numbers if number % 2 == 0])
Add Comment
Please, Sign In to add comment