Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- values = (0, 300, 900, 2700, 6500, 14000, 23000, 34000,
- 48000, 64000, 85000, 100000, 120000, 140000,
- 165000, 195000, 225000, 265000, 305000, 335000)
- my_xp = 37785
- for i in range(len(values)):
- # i starts at 0 and len(values) = 20 so i will be 0-19.
- if i == len(values)-1:
- # We have reached the end of the tuple, meaning that the
- # character has reached max level.
- print(f'Level {i+1} (Max lvl)')
- # If any of the if statements evaluate to true, there is no need to continue.
- break
- elif my_xp == values[i]:
- print(f'Level {i+1} (1st)')
- # If any of the if statements evaluate to true, there is no need to continue.
- break
- elif my_xp > values[i] and my_xp < values[i+1]:
- print(f'Level {i+1} (2nd)')
- # If any of the if statements evaluate to true, there is no need to continue.
- break
Add Comment
Please, Sign In to add comment