Python Data Types Explained for Beginners (int, float, string, bool)
Python Data Types Explained for Beginners (int, float, string, bool) Python Data Types Explained for Beginners (int, float, string, bool) By Ayush Gupta Introduction In the previous post, we learned about Python variables. Now let’s understand what type of data those variables can store. Python has different data types , and in this post, we will focus on the four most important ones: int float string bool --- What is a Data Type? A data type tells Python what kind of value a variable is holding. Based on the data type, Python decides how the data should be stored and used. Data Type = Type of data stored in a variable --- 1️⃣ Integer (int) An integer is a whole number without a decimal point. age = 21 marks = 90 print(age) print(marks) Examples of integers: 10 -5 0 --- 2️⃣ Float (float) A float is a number that contains a decimal point. price = 99.50 percentage = 87.75 print(price) print(percentage) Any ...