SimeonTs

SUPyF2 Basic Exercise More - 02. Find The Capitals

Sep 24th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. """
  2. Basic Syntax, Conditional Statements and Loops - Exercise
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1720#1
  4. Video: https://www.youtube.com/watch?time_continue=4&v=7sHE4HEUqi8
  5.  
  6. SUPyF2 Basic Exercise More - 02. Find The Capitals
  7.  
  8. Problem:
  9. Write a program that takes a single string and prints a list of all the indices of all the capital letters
  10.  
  11. Examples:
  12. Input:      Output:
  13. pYtHoN      [1, 3, 5]
  14. CApiTAls    [0, 1, 4, 5]
  15.  
  16. Hint:
  17. If you don't know what lists are, search them in google, find out how to create them and add elements to them
  18. """
  19. # text = [letter for letter in input()]
  20. # list_capitals = []
  21. #
  22. # for letter in range(len(text)):
  23. #     if text[letter].isupper():
  24. #         list_capitals += [letter]
  25. #
  26. # print(list_capitals)
  27.  
  28. # input_string = input()
  29.  
  30. input_string = input()
  31. n = [i for i in range(len(input_string)) if input_string[i].isupper()]
  32. print(n)
Add Comment
Please, Sign In to add comment