В продолжение прошлого поста про цифры в мире строк.
Почему методы isdigit() и isnumeric() не определяют в строке float и отрицательные значения?
Дело в том, что эти методы работают с ЦИФРАМИ, то есть с единичным символом. А строка "-2" или "3.4" это уже ЧИСЛО. То есть не символ а значение, записанное несколькими символами.
Все озвученные методы проходятся по каждому символу строки и проверяют их индивидуально.
В юникоде есть символы цифр с точками "🄀⒈⒉⒊⒋⒌⒍⒎⒏⒐"
Каждая из них это ОДИН СИМВОЛ, поэтому он будет считаться цифрой
>>> '⒌'.isdigit(), '⒌'.isnumeric()
True, True
Но когда мы пишем это выражение в два символа ( 5+точка), то это не работает.
>>> '5.'.isdigit(), '5.'.isnumeric()
False, False
А еще есть такие символы
>>> '⑴⑵⑶⑷⑸'.isdigit()
True
>>> '🄁🄂🄃'.isdigit()
True
Но они не преобразуются в десятичные цифры
>>> '⒈'.isdecimal()
False
>>> '🄃'.isdecimal()
False
>>> '⑶'.isdecimal()
False
#basic
In which language does "39" (spoken as san kyuu) sound like "thank you" due to the influence of English?
🧠 Follow @languagetrivia for more
#numbers
Check out the correct answer in the comments
In which language is "520" commonly used in messaging to mean "I love you"?
🧠 Follow @languagetrivia for more
#regular_multiple_choice#numbers
Check out the correct answer in the comments
How many English words made their first recorded appearance in Shakespeare’s writings?
A) 200
B) 1700
C) 4000
D) 18000
Take the quiz below to check if you guessed it right
@languagetrivia#numbers#history
The Week in Numbers: Christmas is cancelled
Chinese coal prices are at record levels, U.S. gasoline is at seven-year highs and benchmark crude climbs by the day. Signs of an energy crunch can be found wherever you look. More of the big numbers in business from the past week.
#News#Reuters#numbers#energycrisis#France#Bitcoin
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖