Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def round_up_to_two_digits(number):
- num_str = str(number)
- if len(num_str) <= 2:
- return int(num_str)
- else:
- return int(num_str[:2]) + 1 if int(num_str[2]) >= 5 else int(num_str[:2])
- rounded_number = round_up_to_two_digits(9876543210)
- print(rounded_number) # Output: 99
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement