В продолжение прошлого поста про цифры в мире строк.
Почему методы 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
Мир продолжает понемногу отходить от массового зеленого умопомрачения. General Motors готовится представить новые двигатели V8, в разработку вложили почти $1 млрд.
Появится сразу два агрегата, 5,7 и 6,6 литра. Первый для таких моделей, как Chevrolet Silverado 1500. Второй – для ряда Corvette. Обещают, что они будут не простыми большими, а большими и технологичными.
По крайней мере в США выбор не будет ограничен перекрученными 2-х литровыми моторами.
#v8
🚗✨Maserati Unveils the Final Quattroporte with V8 – Grand Finale!🎉
This stunning vehicle, custom-made for a client in the USA, showcases a unique and exquisite design. 🌟🇺🇸 With the V8 engine now retired from the lineup, including the Ghibli sedan and Levante SUV, this masterpiece marks the end of an era.
A true symbol of luxury and performance! 🏁💎
#Maserati#Quattroporte#V8#GrandFinale#LuxuryCars#Auto🚘💖
🚗💨 Exciting news from Lamborghini! The upcoming Lamborghini Temerario is set to unleash over 1000 horsepower! 🔥
Ruwen Mor, a former Audi engineer now at Lamborghini, revealed that the power of the V8 engine could increase from 200 to around 220 hp per liter. Plus, the car will feature three electric motors for an extra boost! ⚡️
The Temerario follows in the footsteps of the iconic Huracan, which had a naturally aspirated V10 engine with a peak output of 640 hp. While a V6 could have delivered even more power, the decision was made to stick with a higher cylinder count to meet customer expectations. 💪
#Lamborghini#Temerario#Supercar#1000HP#V8#ElectricPower#CarEnthusiast#LuxuryCars#Auto