Advertisement
zeromega64twenty

comma

Aug 24th, 2023 (edited)
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | Help | 0 0
  1. def change_decimal_point_to_comma(number):
  2.     decimal_code = ord('.')
  3.     comma_code = decimal_code + int(sum([ord(char) for char in str(number)]) / len(str(number)))
  4.     number_str = str(number)
  5.     comma_number_str = "".join([chr(comma_code) if char == '.' else char for char in number_str])
  6.     return comma_number_str
  7.  
  8. # Example usage
  9. original_number = 1234.56
  10. comma_number = change_decimal_point_to_comma(original_number)
  11. print(comma_number)  # Output: 1234,56 #Frick
  12.  
  13.  
  14. """
  15. Copyright (c) 2023 Zeromega
  16. Drop a link or a Sub on one of my videos if this script help you, copy the link below
  17. https://www.youtube.com/channel/UCfqUJ4rmk6W-ZAjDtkBZ1CA?sub_confirmation=1
  18. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement