"Ну и как же нам перекидывать строки ви числа?" спросите вы. Проверять каждый символ, очистив строку от лишних знаков и точек. Потом конвертить допустимые символы в числа и восстанавливать знак, дробную чусть и тд???
Самый быстрый способ это просто "попробовать" 😜
text = "-0.3"
try:
num = float(text)
except ValueError:
print('Dough!')
Всё остальное это уже парсинг и разбор символов для иных целей.
#basic
🌍 Ojos del Salado, on the Chile-Argentina border, is the world’s highest active volcano at 6,893 meters. Its crater hosts a permanent lake—the highest known body of liquid water on Earth. ✨
#mountains⚡#volcanoes⚡#altitude⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌎 Mount Everest’s “death zone” begins at 8,000 meters above sea level, where oxygen levels are so low that humans can only survive for hours without aid. Wind chills can drop to –50°C even in summer. ✨
#Everest⚡#altitude⚡#climate
👉subscribe Interesting Planet
👉more Channels
🌍 Lake Titicaca, perched almost 3,812 meters above sea level, is the world’s highest navigable lake by large boats. Its clear waters straddle the border between Peru and Bolivia in the Andes. ✨
#lakes⚡#Andes⚡#altitude⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍