Ravindra Bagale · Data Scienceसर्व coursesया course चे lessonsशोधाEnglish

Data Science · मराठी आवृत्ती

3.1 Variables आणि types

रवींद्र बागले यांच्या course वर आधारित · सहज मराठीत explanation

Variable मध्ये value ठेवतो. Text साठी str, पूर्ण संख्येसाठी int, दशांशासाठी float आणि हो/नाहीसाठी bool वापरतो.

city = "Pune"                 # str
orders_today = 212            # int
gmv = 1_25_450.75             # float (underscores OK in Python 3.6+)
is_festival = True            # bool
print(type(city), type(gmv))

वाचायला सोपे messages तयार करण्यासाठी f-strings वापरा:

print(f"{city} GMV today: ₹{gmv:,.2f}")
# Pune GMV today: ₹125,450.75

Python मधलं :, formatting international पद्धतीने हजारांचा separator लावतं. Report मध्ये लाखांच्या Indian format ची गरज असेल तर पुढे वेगळं formatting करावं लागतं. Class मध्ये :,.2f पुरेसं आहे.