Advertisement
eNeRGy90

Untitled

Jan 31st, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. text = input()
  2. sum = 0
  3.  
  4. for i in range(len(text)):
  5.     if text[i] == "<":
  6.         sum = 0
  7.         for b in range(i, len(text)):
  8.             if ord(text[b]) in range(48, 58):
  9.                 sum += int(text[b])
  10.             if text[b] == ">":
  11.                 print(f"Found {sum} carat diamond")
  12.                 break
  13.  
  14. if sum == 0:
  15.     print(f"Better luck next time")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement