Python Data Types for AI: My Beginner Notes with Examples

I’m a Computer Science graduate transitioning into Artificial Intelligence, currently focused on building strong fundamentals in Python and Machine Learning. I previously worked in the manufacturing industry as an Electrical Design Engineer and Machine Operator, which shaped my practical and disciplined approach to problem-solving. On this blog, I share what I’m learning, small projects I build, and lessons from the journey — learning in public, one step at a time.
To store data in Python you need to use a variable. And every variable has its type depending on the value of the data stored. Python has dynamic typing, which means you don't have to explicitly declare the type of your variable -- but if you want to, you can. Lists, Tuples, Sets, and Dictionaries are all data types and will have dedicated blog later on with more details, but we'll look at them briefly here
Determining the Type
First of all, let's learn how to determine the data type. Just use the type() function and pass the variable of your choice as an argument, like the example below.
print(type(my_variable))
Boolean
The boolean type is one of the most basic types of programming. A boolean type variable can only represent either True or False.
#1 determining type (boolean)
my_boolean = True
print(type(my_boolean))
# output - <class 'bool'>
Numbers
There are three types of numeric types: int, float, and complex.
#2 determining type (integer)
my_integer = 50
print(type(my_integer))
# output - <class 'int'>
#3 determining type (float)
my_float = 5.99
print(type(my_float))
# output - <class 'float'>
#4 determining type (complex)
my_complex = 2j
print(type(my_complex))
# output - <class 'complex'>
#ex-2 determining type (complex)
hey_complex = 3 + 3j
print(type(hey_complex))
# output - <class 'complex'>
String
The text type is one of the most commons types out there and is often called string or, in Python, just str.
#5 determining type (string)
my_string = "hello world"
print(type(my_string))
name = "indrajeet sisodiya"
print(type(name))
#output - <class 'str'>
Final Thoughts
This post covers the basic data types I encountered while learning Python for AI and Machine Learning. Writing and testing these small examples helped me understand how Python treats different kinds of values.
Some introductory explanations were inspired by resources like freeCodeCamp, but all code examples and understanding shared here come from my own practice and experimentation.
In the next post, I’ll move on to Python collection types like lists, tuples, sets, and dictionaries, which are heavily used when working with real datasets.

