Guest User

Untitled

a guest
May 26th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. values = (0, 300, 900, 2700, 6500, 14000, 23000, 34000,
  2. 48000, 64000, 85000, 100000, 120000, 140000,
  3. 165000, 195000, 225000, 265000, 305000, 335000)
  4.  
  5. my_xp = 37785
  6.  
  7. for i in range(len(values)):
  8. # i starts at 0 and len(values) = 20 so i will be 0-19.
  9. if i == len(values)-1:
  10. # We have reached the end of the tuple, meaning that the
  11. # character has reached max level.
  12. print(f'Level {i+1} (Max lvl)')
  13.  
  14. # If any of the if statements evaluate to true, there is no need to continue.
  15. break
  16. elif my_xp == values[i]:
  17. print(f'Level {i+1} (1st)')
  18.  
  19. # If any of the if statements evaluate to true, there is no need to continue.
  20. break
  21. elif my_xp > values[i] and my_xp < values[i+1]:
  22. print(f'Level {i+1} (2nd)')
  23.  
  24. # If any of the if statements evaluate to true, there is no need to continue.
  25. break
Add Comment
Please, Sign In to add comment